198 Commits

Author SHA1 Message Date
Milan Broz
d7960b9307 Simplify global error call.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@622 36d66b0a-2a48-0410-832c-cd162a569da5
2011-10-09 13:45:38 +00:00
Milan Broz
19bde65f5b Remove hints for old kernels.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@616 36d66b0a-2a48-0410-832c-cd162a569da5
2011-10-08 16:23:54 +00:00
Milan Broz
d2fbc963ca If device is not rotational, do not use Gutmann wipe method.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@615 36d66b0a-2a48-0410-832c-cd162a569da5
2011-10-08 16:17:08 +00:00
Milan Broz
4a295781d1 Silent gcc warnings with -Wconst-qual switch.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@598 36d66b0a-2a48-0410-832c-cd162a569da5
2011-08-15 16:32:52 +00:00
Milan Broz
f80b506b65 * Allow different data offset setting for detached header.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@576 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-20 17:39:38 +00:00
Milan Broz
261d0d05a5 Add crypt_get_iv_offset() function to API.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@573 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-18 13:03:15 +00:00
Milan Broz
913ef7c07e Rewrite dm query/create function backend.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@570 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-17 22:35:17 +00:00
Milan Broz
d44d07c9eb * Add --shared option for creating non-overlapping crypt segments.
* Add shared flag to libcryptsetup api.
* Fix plain crypt format parameters to include size option (API change).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@559 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-01 16:38:58 +00:00
Milan Broz
4f657c17a2 Move DM helpers to separate header.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@530 36d66b0a-2a48-0410-832c-cd162a569da5
2011-05-24 11:19:12 +00:00
Milan Broz
2755f37266 Move devpath scan to separate file.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@529 36d66b0a-2a48-0410-832c-cd162a569da5
2011-05-24 11:19:00 +00:00
Milan Broz
231a2e932d Fix possible leaks in blockwise read/write code.
Fix lseek_write blockwise function (not used in that mode anyway).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@511 36d66b0a-2a48-0410-832c-cd162a569da5
2011-04-18 10:52:15 +00:00
Milan Broz
c31854e2b3 Check for plain64 IV support in DM backend.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@477 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-22 08:51:00 +00:00
Milan Broz
25512d89ae Clean up plain password hashing, do not ignore error in crypto backend.
(New backend can fail there).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@451 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-13 23:50:49 +00:00
Milan Broz
13f4feaaf7 Add backing device info into status.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@445 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-12 20:23:25 +00:00
Milan Broz
be3448fb8a Separate loop handling from internal code.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@444 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-12 20:23:16 +00:00
Milan Broz
d9ba34693f Add support for automatic loop device use (image infile etc).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@443 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-11 19:04:37 +00:00
Milan Broz
0165301357 Better detects dm-ioctl secure flag using version before use.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@435 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-05 21:59:21 +00:00
Milan Broz
66bea4b3be Add dm flags for query for features.
Move adjust device helper to utils.
Fix locking memory message.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@416 36d66b0a-2a48-0410-832c-cd162a569da5
2011-01-25 18:48:41 +00:00
Milan Broz
d04d9f336a Switch to new crypto backend interface.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@408 36d66b0a-2a48-0410-832c-cd162a569da5
2010-12-31 14:33:43 +00:00
Milan Broz
b13b4b7654 Remove uneeded function prototype.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@374 36d66b0a-2a48-0410-832c-cd162a569da5
2010-11-15 17:03:43 +00:00
Milan Broz
b7caa72acd * Disallow mapping of device which is already in use (mapped or mounted).
* Disallow luksFormat on device in use.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@361 36d66b0a-2a48-0410-832c-cd162a569da5
2010-11-05 17:53:33 +00:00
Milan Broz
dfe77be748 * Implement --use-random and --use-urandom for luksFormat to allow setting of RNG for volume key generator.
* Add crypt_set_rng_type() and crypt_get_rng_type() to API.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@354 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-27 15:35:23 +00:00
Milan Broz
3ae161df5d Move get_key to common code, simplify verify flags.
(This code need rewrite anyway).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@352 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-26 22:08:02 +00:00
Milan Broz
3a5a1ea0e7 Move safe alloc routines into common lib file.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@351 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-26 22:07:43 +00:00
Milan Broz
bb8e085378 Add utils_crypt file and test for supported modes presentation.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@348 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-26 14:34:47 +00:00
Milan Broz
3b50005d2f Simplify crypto backend init.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@347 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-26 14:34:35 +00:00
Milan Broz
ef10cd09ec Generalise volume key struct.
Do not generate unused volume key in PLAIN mode.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@346 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-26 14:34:17 +00:00
Milan Broz
ef44e6e3d3 Use default data alignment to 1MiB.
If there is topology info, use default if topology is multiple of default,
otherwise use topology values.

See https://bugzilla.redhat.com/show_bug.cgi?id=621684 and issue 55.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@325 36d66b0a-2a48-0410-832c-cd162a569da5
2010-08-09 16:34:42 +00:00
Milan Broz
b4ebe0be18 Add verbose log level and move unlocking keyslot messages there.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@238 36d66b0a-2a48-0410-832c-cd162a569da5
2010-05-27 18:44:14 +00:00
Milan Broz
743fbbc451 Support topology information for data alignment (LUKS).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@195 36d66b0a-2a48-0410-832c-cd162a569da5
2010-04-09 15:35:19 +00:00
Milan Broz
ad224b479a Change in iterations counts:
* 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 key digest iteration # is calculated from iteration time (approx 1/8 of that).

If something very strange happens, and the generated key is not completely random
(wrong RNG), attacker can skip the whole kesylot area processing and try to
brute force key according to limited set of keys.

The iteration time (default, inherited from slot iteration time, is cca 120ms)
can make this attack slower, if not impossible.

Note, that this is just theorethic problem, anyway it is better to be prepared
if possible:-)

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@159 36d66b0a-2a48-0410-832c-cd162a569da5
2009-12-30 19:02:44 +00:00
Milan Broz
df389199d0 Use proper NLS macros and detection (so the message translation works again).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@145 36d66b0a-2a48-0410-832c-cd162a569da5
2009-11-16 20:10:20 +00:00
Milan Broz
c3064c9442 Add temporary debug code to allow better debugging of races
with various udev-event tools which wrongly scan and open
internal temporary cryptsetup devices.

If cryptsetup run in debug mode (--debug) and remove of device
fails, code scan /proc directory and tries to find process name
which locked that device.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@141 36d66b0a-2a48-0410-832c-cd162a569da5
2009-11-15 19:26:36 +00:00
Milan Broz
2bda053677 Rename internal locking helpers (avoids conflict when statically linking.)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@132 36d66b0a-2a48-0410-832c-cd162a569da5
2009-10-23 10:42:56 +00:00
Milan Broz
8bec41ab34 Properly apply versioned symbols in library and fix problems uncovered
by doing that:-)

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@124 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-30 15:07:41 +00:00
Milan Broz
e026f089be Add luksHeaderBackup and luksHeaderRestore commands and API cals.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@114 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-28 17:45:38 +00:00
Milan Broz
935e83ebfa Initialize crypto library before LUKS header load.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@111 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-15 15:10:23 +00:00
Milan Broz
a47856ac49 Use dm-uuid for all crypt devices, contains device type and name now.
DM_UUID now contains prefix (CRYPT-), device type (LUKS1, PLAIN, TEMP),
UUID (if provided - LUKS) and device name.

Because e.g. snapshot of full LUKS device during activation must have different
name, DM-UUID is different too and we do not need --disable-uuid option.

DM-UUID is persistent during activation time.

* Revert (and solve different way): Replace not safe option --non-exclusive with --disable-uuid.

Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@105 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-08 06:41:44 +00:00
Milan Broz
3cea5dcc7b * Add luksSuspend (freeze device and wipe key) and luksResume (with provided passphrase).
Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@104 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-02 12:47:21 +00:00
Milan Broz
cee0f0b49f * 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.

Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@93 36d66b0a-2a48-0410-832c-cd162a569da5
2009-08-30 18:09:21 +00:00
Milan Broz
bf7819ccef * Add log macros and make logging modre consitent.
* Move command successful messages to verbose level.
* Introduce --debug parameter.

Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@92 36d66b0a-2a48-0410-832c-cd162a569da5
2009-08-30 18:07:17 +00:00
Milan Broz
4e471a9b03 * Move memory locking and dm initialization to command layer.
* Increase priority of process if memory is locked.

Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@91 36d66b0a-2a48-0410-832c-cd162a569da5
2009-08-30 18:07:00 +00:00
Milan Broz
ab953b3ff6 Require device device-mapper to build and do not use backend wrapper for dm calls.
Signed-off-by: Milan Broz <mbroz@redhat.com>

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@90 36d66b0a-2a48-0410-832c-cd162a569da5
2009-08-30 17:56:33 +00:00
Milan Broz
e3e3027e12 Optimize o_direct read/writes.
* Pad luks header to 512 sector size. We need read/write in whole
sector anyway and space is unused (wiped in luksFormat) so there is
no need for read/seek/write exercise.

* Rework read/write blockwise to not split operation to many pieces.
thanks to Sebastian Andrzej Siewior:

  The buffer has to be aligned due to the O_DIRECT in open(). Currently a small
  blocksize buffer is allocated and everything is read in multiple reads and
  copied back to the original buffer. In my case AFEKSize gets computed to 64000
  which results in 125 reads with 512 bytes each.
  This patch changes this behavior to a single operation where the majority is
  read()/write() plus an optional fixup in case the request is not modulo block
  size.

* Use posix_memalign and check for alignment if available.
Othewise use old align functions. Add autoconf to detect posix_memalign.



git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@74 36d66b0a-2a48-0410-832c-cd162a569da5
2009-07-28 09:29:13 +00:00
Milan Broz
dca5a38513 Set UUID in device-mapper for LUKS devices.
Device mapper device should use UUID string if possible.
UDEV can then easily distinguish the device type etc.

cryptsetup now uses CRYPT prefix for uuid.



git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@55 36d66b0a-2a48-0410-832c-cd162a569da5
2009-06-20 20:24:56 +00:00
Milan Broz
c0aeac6a34 Use remapping to error target instead of calling udevsettle for temporary crypt device.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@32 36d66b0a-2a48-0410-832c-cd162a569da5
2008-09-16 15:35:50 +00:00
Clemens Fruhwirth
98cf0aedf8 Thanks to Ivan Stankovic
* write_lseek_blockwise: declare innerCount outside the if block
* add -Wall to the default CFLAGS
* fix some signedness issues



git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@29 36d66b0a-2a48-0410-832c-cd162a569da5
2008-09-01 08:54:05 +00:00
Clemens Fruhwirth
7dc7b90a9b Initial checking of what was revision 56 on http://luks.endorphin.org/svn/cryptsetup
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@3 36d66b0a-2a48-0410-832c-cd162a569da5
2008-03-22 08:23:35 +00:00