Commit Graph

1282 Commits

Author SHA1 Message Date
Milan Broz
a58ed1ada3 Better specify error codes from crypt_wipe. 2017-06-22 13:32:05 +02:00
Milan Broz
c80dbb2210 Fxi luksKill slot to work in batch mode in non-tty environment.
If there is no TTY on stdin (like nohup or service) then
batch mode should not fail to kill slot.

For more info see Issue#329.
2017-06-21 13:31:08 +02:00
Milan Broz
ce1e5374b9 Fix API tracker URL. 2017-06-18 09:00:11 +02:00
Ondrej Kozina
c4fa881303 luks1: cleanup for added checks
related to bef56af730
2017-06-16 11:09:41 +02:00
Milan Broz
d02b291e2f Remove TODO line. 2017-06-15 13:57:27 +02:00
Milan Broz
4d21f4673d Add Travis configuration file for automated testing. 2017-06-15 13:46:36 +02:00
Ondrej Kozina
6682e6b663 tests: add test for overlaping keyslots in luks1 image 2017-06-15 11:17:36 +02:00
Ondrej Kozina
bef56af730 luks1: harden checks for possibly corrupted headers
this patches improves two areas:

1) it checks for keyslot areas overlaping each other
2) it checks if all keyslot areas fit in header area of device
   (pre-data-offset area) or if it can fit file (detached header)
   it's being loaded from. Those new checks are based on real data
   found in header (offsets) rather than based on assumption calculated
   from key length
2017-06-15 11:17:28 +02:00
Milan Broz
c7de6939ae Fix ioctl argument for block size check. 2017-06-09 10:33:57 +02:00
Milan Broz
2059266a24 Never decrease device block size (for example after attaching loop device). 2017-06-08 16:22:53 +02:00
Milan Broz
edba04c978 Fix batch mode for tools progress function. 2017-06-08 15:05:28 +02:00
Milan Broz
73030aa5fb Make block size size_t type.
And fix all related comparisons and functions.
2017-06-08 14:39:54 +02:00
Milan Broz
34bf809e51 Use device alignment wrapper.
And cache the value to not call ioctl on every block read/write.
2017-06-08 09:30:53 +02:00
Milan Broz
fd6fc16001 Use tools progress print function for cryptsetup-reencrypt. 2017-06-07 21:58:19 +02:00
Milan Broz
e438acfc5f Add wipe of device to integritysetup format. 2017-06-07 15:32:24 +02:00
Milan Broz
3a27c84d98 Rewrite and export crypt_wipe function.
The crypt_wipe can be used to wipe any part of the device,
and also to initialize integrity based device (to reset checksum).
2017-06-07 15:31:13 +02:00
Milan Broz
c6408f4b31 Link tools with -lm. 2017-06-07 15:24:12 +02:00
Milan Broz
fc026a722b integritysetup: fix processing of integer options. 2017-06-06 09:47:12 +02:00
Milan Broz
573a05a10f Add Veracrypt test image with PIM setting. 2017-06-01 16:44:52 +02:00
Milan Broz
6fc383ade1 Fix detection of target presence. 2017-06-01 12:25:39 +02:00
Milan Broz
40a9178c7f Rework detection of DM target flags.
Because there are already 3 targets used, the current detection
based only on dm-crypt is not sufficient.

Add new definition of dm_flags that allows separate target version detect.

Note: we do not want to load targets explicitly; instead, we repeats
detection after operation that could trigger target load.

If dm_flags() call fails, then the target is not yet loaded.
2017-06-01 09:28:09 +02:00
Milan Broz
82f7cae22c Make FEC verity test determnistic. 2017-05-30 14:50:32 +02:00
Ondrej Mosnáček
f786ed8505 Fix strncat usage
The 'strncat' function may write up to n + 1 bytes into destination, so
the 'n' parameter must be sizeof(dest) - strlen(dest) - 1. See [1] for
a nice explanation from US CERT.

[1] https://www.us-cert.gov/bsi/articles/knowledge/coding-practices/strncpy-and-strncat
2017-05-29 12:08:21 +02:00
Milan Broz
7e06265568 Parse integrity mode directly. 2017-05-29 10:40:06 +02:00
Milan Broz
2a50be152e Increase library and symbols version. 2017-05-29 10:23:24 +02:00
Milan Broz
ba5e91e278 Skip integrity test if target not available. 2017-05-28 23:02:49 +02:00
Milan Broz
5a3e3339e0 Make integrity param optional. 2017-05-28 22:47:05 +02:00
Milan Broz
0bb7098fd8 Add integritysetup command line tool for the dm-integrity standalone setting.
The dm-integrity target is intended to be used for authenticated
encryption through LUKS and dm-crypt.

It can be used in standalone as well; for this use case there
is a simple configuration utility called integritysetup
(similar to veritysetup to dm-verity).
2017-05-28 09:22:17 +02:00
Milan Broz
290b593d0b Add runtime check for FEC availability to dm-verity test. 2017-05-15 16:07:17 +02:00
Michal Virgovic
2745be83dd Add tests for FEC dm-verity extension. 2017-05-15 12:39:06 +02:00
Tobias Stoeckmann
44d5269c0a Prevent double free with invalid verity partition.
It is possible to trigger a double free with an invalid verity
partition. All it takes is an unknown hash algorithm, which makes it
a bit more likely than a completely broken partition header. But all
it takes is an error return value of VERITY_read_sb() or strdup().

If crypt_load fails before setting cd->type, crypt_free will handle
the union as if it was of type "none", which means it will call free()
for "active_name", a field which is only properly set up when the
type was actually "none".

In all other cases, "active_name" contains the first 4 or 8 bytes of
the actually used header structure. Fortunately it can be only a
pointer or NULL, so an attacker has no direct control of the value.
Nonetheless it can easily trigger a double free.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-05-02 08:25:40 +02:00
Milan Broz
3f9346836e Get rid of old alignment code and use posix_memalign.
We require posix_memalign already for some time so it makes
no sense to keep old workarounds.
2017-04-30 13:13:46 +02:00
Michal Virgovic
5d1b6f9af3 Update veritysetup man with FEC options. 2017-04-29 15:56:49 +02:00
Milan Broz
882751b51e Update po file... 2017-04-27 12:26:47 +02:00
Milan Broz
bbd59fa314 Fix stupid version typo in release notes. 2017-04-27 10:56:12 +02:00
Milan Broz
57c9d78629 Update README.md. 2017-04-27 10:47:43 +02:00
Milan Broz
78c9004a87 Add 1.7.5 release notes. 2017-04-27 08:42:00 +02:00
Milan Broz
8df2a598a7 Align benchmark output even for longer cipher names. 2017-04-26 14:32:54 +02:00
Harald Hoyer
1691282314 dracut-reencrypt: call "udevadm settle" once more
Somehow testing in qemu resulted sometimes in an endless loop.
Either the timing or the settle fixed the issue.
When the VM was in an endless loop, an strace showed, that the first 512
and 1024 of the crypt partition was read over and over. Either it was
the udev blkid, or some device mapper udev rule.
Maybe the reencrypt tool opens and closes the device fd, where the close
triggers a udev blkid and causes the reencrypt tool to reread the device...
Anyhow.. with this settle the issue was not seen anymore.
2017-04-26 10:50:44 +02:00
Harald Hoyer
3d6bb53b31 dracut-reencrypt: add UUID handling to rd.luks.reencrypt=
This patch adds a udev rule, so that you can specify
rd.luks.reencrypt=<UUID> instead of rd.luks.reencrypt=<devname>

It also moves the job to the "settled" queue, which means, that it is
executed after udev has settled.
2017-04-26 10:50:41 +02:00
Harald Hoyer
6a8a6aea54 dracut-reencrypt: add finished hook
A finished hook prevents dracut-initqueue from exiting and lets it
finish the batched jobs. Without a "finished hook" and without
"root=<dev>" on the kernel command line, the reencrypt job would not be
executed.

Normally you want to reencrypt without a "root=<dev>" on the kernel
command and want to reboot after the reencrypt job is done.

This patch adds the missing "finished hook".
2017-04-26 10:50:36 +02:00
Milan Broz
8c5760fee7 Fix API test for FIPS mode. 2017-04-21 09:32:13 +02:00
Milan Broz
3c2135b36b Fix luksFormat if running in FIPS mode on recent kernel.
Recently introduced check for weak keys for XTS mode makes
zeroed key for algorithm check unusable.

Use random key for the test instead.
2017-04-21 08:22:29 +02:00
Milan Broz
aad597b987 Fix activation of verity device with superblock and FEC. 2017-04-20 09:10:18 +02:00
Milan Broz
5fdfc0b54a Fix AF prototypes and move then to af.h. 2017-04-14 13:25:21 +02:00
Milan Broz
ef966bd261 Fix verity FEC block memory allocation.
Fixes corruption of memory when buffer is too small.
2017-04-14 12:31:44 +02:00
Milan Broz
54cb40fce7 Fix RS algorithm rewrite typo. 2017-04-05 16:29:26 +02:00
Milan Broz
c6a0048b9b Add check for FEC support in kernel dm-verity. 2017-04-05 15:16:13 +02:00
Milan Broz
425e8b9495 Fix possible divide by zero in verity hash blocks calculation. 2017-04-05 14:35:52 +02:00
Milan Broz
82dd6c7fa2 Fix some compiler warnings. 2017-04-05 14:24:20 +02:00