Commit Graph

1622 Commits

Author SHA1 Message Date
Milan Broz
23ce9aa47e Fix crypt_generate_volume_key to use size_t for keylength. 2016-07-02 21:01:25 +02:00
Tobias Stoeckmann
a0587d4307 Avoid integer overflows during memory allocation.
It is possible to overflow integers during memory allocation with
insanely large "key bytes" specified in a LUKS header.

Although it could be argued to properly validate LUKS headers while
parsing them, it's still a good idea to fix any form of possible
overflow attacks against cryptsetup in these allocation functions.
2016-07-02 20:57:10 +02:00
Milan Broz
ea5e9c9fe2 Merge branch 'stoeckmann/cryptsetup-master' 2016-07-02 20:42:32 +02:00
Tobias Stoeckmann
14ebbce280 Avoid buffer overflow in uuid_or_device.
The function uuid_or_device is prone to a buffer overflow if a very long
spec has been defined. The range check happens against PATH_MAX, with
i being set to 5 (due to "UUID=" offset of spec), but "/dev/disk/by-uuid"
has been already written into device.

The difference between "/dev/disk/by-uuid" and "UUID=" is 13, therefore
the correct range check must happen against PATH_MAX - 13.
@@ -204,7 +204,7 @@ const char *uuid_or_device(const char *spec)
                strcpy(device, "/dev/disk/by-uuid/");
2016-07-02 20:41:51 +02:00
Milan Broz
67d55d08f8 Fix PBKDF2 benchmark to not double iteration count for corner case.
If measurement function returns exactly 500 ms, the iteration
calculation loop doubles iteration count but instead of repeating
measurement it uses this value directly.

Thanks to Ondrej Mosnacek for bug report.
2016-06-23 09:47:22 +02:00
Milan Broz
4d3a501b83 Force test to read device to detect corrupted blocks.
(If udev scanning is switched off, there is no real activity on device yet.)
2016-06-23 09:45:06 +02:00
Ondrej Kozina
16fab74ab1 code cleanup related to devfd checks
alter all checks for devfd value after device_open to
less than zero insted of equals to -1. device_open will
return values different from -1 in case error happens.

In LUKSv1 device_open should always return -1 in case of
error but this check is safer.

The rest is just formating improvement.
2016-06-08 13:12:06 +02:00
Milan Broz
f397d42d73 Update Readme.md. 2016-06-04 14:22:00 +02:00
Milan Broz
576a2e5b86 Workaround for align test for scsi_debug kernel in-use issue. 2016-06-04 13:12:15 +02:00
Milan Broz
060a4fbef0 Fix possible leak if reencryption is interrupted. 2016-06-04 12:36:51 +02:00
Milan Broz
f473fb3d7d Revert soname change. 2016-06-04 12:34:43 +02:00
Milan Broz
36f6073ec5 Set devel version. 2016-06-04 11:41:46 +02:00
Milan Broz
ebf7732943 Add 1.7.2 Release notes. 2016-06-04 11:36:36 +02:00
Milan Broz
c62427fd47 Update po files. 2016-06-02 19:18:04 +02:00
Milan Broz
ff09d1c531 Update po files. 2016-05-25 15:10:12 +02:00
Milan Broz
2852a48e6a Fix error message. 2016-05-25 14:56:13 +02:00
Milan Broz
1ab1803a43 Update po files. 2016-05-19 13:12:15 +02:00
Milan Broz
8f84fb49fa Fix help text for cipher benchmark specification. 2016-05-18 09:11:52 +02:00
Ondrej Kozina
e1dca468f5 keymanage: eliminate double close() call
fix  double close() cases in LUKS_hdr_backup() and LUKS_hdr_restore()
functions. It should be harmless unless libcryptsetup is used
in multi-thread setup which is not supported anyway.
2016-05-13 13:05:46 +02:00
Milan Broz
b1b3d93c96 Add ABI tracker output link. 2016-05-07 10:19:05 +02:00
Milan Broz
7d80112d4f Update LUKS doc format.
Clarify fixed sector size and keyslots alignment.
2016-05-04 15:48:04 +02:00
Milan Broz
4dd703ea6c Support activation options for error handling modes in dm-verity.
This patch adds veritysetup support for these Linux kernel dm-verity options:

  --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 behaviour 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 serious security or functional impacts,
do not use them without assessing the risks!
2016-05-04 10:07:47 +02:00
Milan Broz
99a254f2f6 Fix dm-verity test typo. 2016-05-04 09:14:32 +02:00
Ondrej Kozina
1b7799cb1d dracut_90reencrypt: fix warns reported by static analysis
- moddir is assigned in parent script run by dracut (warning was
  silenced)

- fix defect wrt to assignement and making variable local on
  same line. The variable cwd was first assigned by subshell
  and later any error originating in subshell was masked by
  making the variable local (which returns always 'true')
2016-04-25 15:47:18 +02:00
Milan Broz
7eba57b4c0 Avoid possible divide-by-zero warnings. 2016-04-24 12:38:19 +02:00
Milan Broz
1f51cfcf57 Set devel version. 2016-04-24 12:13:30 +02:00
Milan Broz
683e4db48b Fix warnings reported by static analysis.
- ensure that strings are \0 terminated (most of this is already
handled on higher level anyway)

- fix resource leak in error path in tcrypt.c

- fix time of check/time of use race in sysfs path processing

- insruct Coverity scanner to ignore constant expression in random.c
(it is intented to stop compile-time misconfiguration of RNG that would be fatal)
2016-04-24 12:07:31 +02:00
Milan Broz
c2ddd48f50 Avoid tar archive warnings if tests are run as superuser. 2016-04-19 14:56:43 +02:00
Milan Broz
eb8ff73595 Merge branch 'VittGam/cryptsetup-patch-1' 2016-04-19 11:24:09 +02:00
Milan Broz
54c4b1656f Include sys/sysmacros.h if present.
Needed for major/minor definitions.

Thanks Mike Frysinger for pointing this out.
2016-04-19 10:57:45 +02:00
Milan Broz
1000b40a3a Link reencryption utility to uuid library.
(Fixes last patch.)
2016-04-19 10:22:26 +02:00
VittGam
e7e5354332 Fix off-by-one error in maximum keyfile size.
Allow keyfiles up to DEFAULT_KEYFILE_SIZE_MAXKB * 1024 bytes in size, and not that value minus one.

Signed-off-by: Vittorio Gambaletta <git-cryptsetup@vittgam.net>
2016-04-19 03:58:10 +00:00
Ondrej Kozina
b5365ba13d cryptsetup-reencrypt: enable resume of decryption
to enable resume of interrupted decryption user has
to pass uuid of the former luks device. That uuid is used
to resume the operation if temporary files LUKS-* still
exist.
2016-04-13 15:01:37 +02:00
Milan Broz
f2cdc6f5f4 Update po files. 2016-04-13 14:58:55 +02:00
Arno Wagner
a0c251c7cc sync to WIKI version 2016-03-23 15:53:02 +01:00
Milan Broz
d7a224e47a Disable DIRECT_IO for LUKS header with unaligned keyslots.
Fixes issue#287.

Such a header is very rare, it is not worth to do more detection here.
2016-03-23 13:44:37 +01:00
Milan Broz
6894701392 Merge branch 'athira-rajeev/cryptsetup-fix_device_block_size_fd' 2016-03-23 10:06:40 +01:00
Athira Rajeev
8e4e898ce5 Fix device_block_size_fd to return bsize correctly incase of files.
This patch is for issue #287

In the code for returning block size ( device_block_size_fd in lib/utils_device.c ),
always returns zero in case of files and device_read_test is not executed.

This patch is to fix device_block_size_fd to return block size correctly incase of files.

Signed-off-by: Athira Rajeevatrajeev@linux.vnet.ibm.com
2016-03-19 18:57:45 +05:30
Milan Broz
add8fb8fd2 Update README for 1.7.1. 2016-02-28 14:48:41 +01:00
Milan Broz
3807dbf2f3 Add 1.7.1 release notes. 2016-02-28 13:38:42 +01:00
Milan Broz
b5d1c9241c Fix align test for new scsi_debug defaults. 2016-02-28 11:12:40 +01:00
Ondrej Kozina
3e742452cd cryptsetup-reencrypt: harden checks for hdr backups removal
There're various situations where hdr backups together with log file
may get removed even when the hdr was already marked unusable. This
patch fixes the most sever case already reported and generaly tries
harder protecting the log file and both hdr backups.
2016-02-28 09:44:22 +01:00
Ondrej Kozina
d7b127549c cryptsetup-reencrypt: drop unreachable code path
MAKE_USABLE flag is never used in device_check()
2016-02-28 09:44:07 +01:00
Milan Broz
d841f97d44 Update po files. 2016-02-28 09:31:36 +01:00
Milan Broz
0c7d947d2d Update po files. 2016-02-23 17:41:55 +01:00
Milan Broz
05604b77ea Move README back. 2016-02-23 17:40:10 +01:00
Ondrej Kozina
2c072eb6b6 Clarify the reencrypt_keyslot= option 2016-02-21 18:48:49 +01:00
Milan Broz
080a9863c1 Temporarily rename README.txt (until GitLab updates markdown README preference handling) 2016-01-30 08:33:04 +01:00
Milan Broz
22f5760d47 Update TODO. 2016-01-26 15:17:02 +01:00
Milan Broz
4dc88e8ffb Fix kernel crypto backend to set key before accept call even for HMAC. 2016-01-04 14:19:50 +01:00