65 Commits

Author SHA1 Message Date
Milan Broz
c497945ab3 Make internal dm_flags 64bit. 2025-02-16 20:52:37 +01:00
Ondrej Kozina
6ee76934fa Harden and limit access to volume key internals.
The volume key structure may often be in configuration
where 'key' member does not contain real data. Some
examples:

- volume key acquired by querring device-mapper where key
  was originaly passed by kernel keyring reference.

- volume key allocated by crypt_alloc_volume_key(size, NULL)

With this patch access to internal 'uninitialized' data result
in failed assert().

For use cases where key data are not needed (keyring reference wrapper,
key length info only) we do not have to allocate and lock the safe
buffer in memory.

Further improvements might to completely hide the volume key internals
and access only via setter and getter functions.
2025-02-16 18:00:20 +00:00
Milan Broz
8364178b38 Update copyright year. 2025-01-15 23:09:36 +01:00
Milan Broz
ff3e2c6a43 libdevmapper: Support dm-crypt integrity_key_size option
This patch implement support for setting specific integrity key size
option in dm-crypt, available since dm-crypt version 1.28.0.

This can be used for setting non-standard HMAC key length.

Mostly based on code from Ingo Franzki <ifranzki@linux.ibm.com>
2024-12-03 20:25:54 +01:00
Ondrej Kozina
e4d25d18eb Remove needless double statements. 2024-08-26 17:40:04 +00:00
Milan Broz
661f57def4 Use SPDX license identifiers.
This patch switches code to SPDX one-line license identifiers according to
https://spdx.dev/learn/handling-license-info/
and replacing long license text headers.

I used C++ format on the first line in style
// SPDX-License-Identifier: <id>
except exported libcryptsetup.h, when only C comments are used.

The only additional changes are:
- switch backend utf8.c from LGPL2+ to LGPL2.1+ (as in systemd)
- add some additional formatting lines.
2024-06-03 16:38:15 +00:00
Milan Broz
bd0ef58b3a Update copyright notice to include 2024 year. 2024-01-23 16:10:44 +01:00
Milan Broz
72f799b393 Update Copyright year. 2023-02-09 17:11:18 +01:00
Milan Broz
ab975bc1c4 Update copyright year.
And unify format in several places.
2022-01-29 10:43:02 +01:00
Milan Broz
ca2e1fc956 Fix some includes. 2021-02-27 21:14:38 +01:00
Milan Broz
d1d9dd8e20 Update Copyright year. 2021-01-25 22:00:25 +01:00
Milan Broz
16c7aab99b Fix some (ancient) compiler warnings. 2020-02-21 10:30:39 +01:00
Milan Broz
165e6c234c Fix some error and debug messages.
Use BITLK as format name.

Avoid using doesn't -> does not.
2020-01-11 22:10:59 +01:00
Milan Broz
080566a1fd Update copyright year. 2020-01-03 13:04:55 +01:00
Milan Broz
a6f5ce8c7b Update copyright year.
And unify name copyright format.
2019-01-25 09:45:57 +01:00
Ondrej Kozina
77a62b8594 Remove trailing newline in loopaes error message. 2019-01-07 13:07:45 +01:00
Ondrej Kozina
39a014f601 dm backend with support for multi-segment devices.
Support for multi-segment devices is requirement for online
reencryption to work. Introducing modififed dm backend that
splits data structures describing active device and individual
dm target (or segment).
2019-01-07 13:07:45 +01:00
Ondrej Kozina
120ebea917 Split low level code for creating dm devices.
The separate code for reloading device tables
will be used in later features.
2019-01-01 21:42:46 +01:00
Milan Broz
35fa5b7dfc Propagate context in libdevmapper functions. 2018-11-27 14:47:50 +01:00
Milan Broz
a5a8467993 Use context in debug log messages.
To use per-context logging even for debug messages
we need to use the same macro as for error logging.
2018-11-27 13:37:20 +01:00
joerichey@google.com
59b5f360af Make all header files self-suffienct
Almost all the headers in cryptsetup are self-suffienct (in that they
compile on their own). By including <stddef.h>, <stdint.h>, or
<sys/types.h>, all headers will now compile on their own.

This is useful for importing cryptsetup into Bazel/Blaze.
2018-07-07 10:23:39 +02:00
Milan Broz
b00a87d8fa Remove trailing EOL for verbose and error messages. 2018-04-26 10:38:17 +02:00
Milan Broz
1fe014dbae Update copyright year. 2018-01-20 17:55:21 +01:00
Milan Broz
1ca439f4e0 Fix some warnings found during static analysis. 2018-01-20 14:42:05 +01:00
Milan Broz
d77bbe93c1 Use non-recursive automake.
This change also causes that now binaries and libraries are placed in
build root directory.

Now we can use subdir-objects for automake.
2017-10-12 11:48:17 +02:00
Milan Broz
c56bdee177 Add backend support for new device-mapper kernel options.
This patch adds support for using keyring for volume key
and support for new integrity fields for dm-crypt.

Also helpers for searching disk by id.

To be used later.
2017-09-24 19:49:35 +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
98368c4770 Update copyright years. 2017-03-12 13:17:15 +01:00
Cristian Rodríguez
a809224ec7 Fix all format string issues found by the attribute format patch 2014-04-12 08:52:20 +02:00
Cristian Rodríguez
1349efa34d Fix buildsytem to always include config.h.
- config.h must always be the first file to be included
- Use AM_CFLAGS and AM_LDFLAGS consistently and properly.

(Modified to disable build without largefile support etc
by Milan Broz <gmazyland@gmail.com>)
2013-06-23 17:14:33 +02:00
Milan Broz
2a2444b961 Fix gcc signed/unsigned warning for key length.
And always use unsigned int declaration.
2013-03-31 11:24:26 +02:00
Milan Broz
6127b6959f Update copyright year on changed files. 2013-03-24 09:05:33 +01:00
Milan Broz
330007beb2 Fix loop-AES keyfile parsing.
Loop-AES keyfile should be text keyfile,
properly check that keys are terminated and of the same length.

Fixes issue#153.
2013-03-23 18:10:46 +01:00
Milan Broz
72db6e4de2 Do not support user uuid for plain & loopaes devices.
This function was not documented.
So now crypt_get_uuid() returns only on-disk UUID.
2013-01-22 16:20:09 +01:00
Milan Broz
929dc47be4 Fix displaying of error messages for mising kernel features. 2013-01-08 14:19:31 +01:00
Dave Reisner
ab080ab544 build: use AM_CPPFLAGS instead of INCLUDES
The latter is marked as deprecated as of automake 1.12.4:

warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2012-12-30 18:36:46 +01:00
Milan Broz
7eccb7ff50 Change License for sub-libraries from GPLv2 only to LGPLv2.1+ ("or any later")
This includes crypto, loopaes, tcrypt handling code I have written myself
and verity code written originally by Mikulas Patocka and modified by me,
copyright by Red Hat.

Other part of library have to stay GPLv2+ only for now
(no agreement from all authors).
2012-12-29 11:47:28 +01:00
Milan Broz
83f02e6682 Add copyright line for files I have written or modified. 2012-12-21 16:40:33 +01:00
Milan Broz
97224b072a Add context to DM helpers.
(To be used later.)
2012-08-14 16:25:21 +02:00
Milan Broz
65f975655c New device access backend.
Allocate loop device late (only when real block device needed).
Rework underlying device/file access functions.
Move all device (and ioctl) access to utils_device.c.

Allows using file where appropriate without allocation loop device.
2012-08-12 22:00:17 +02:00
Milan Broz
ce2218ed65 Support init_by_name for verity. 2012-06-08 16:38:26 +02:00
Milan Broz
c4b16923bb Unify dm backend for crypt/verity. 2012-06-08 10:12:12 +02:00
Milan Broz
b016e65daa Use union in dm (crypt/verity) query structure. 2012-06-08 08:58:35 +02:00
Milan Broz
20eea64334 Add version string to crypto backend.
Move fips check to libcryptsetup.
Clean up internal.h use.
2012-05-27 00:48:10 +02:00
Milan Broz
ee8425b836 Version 1.4.2.
Add header and copyright for header files.
2012-04-02 22:03:05 +02:00
Milan Broz
7835b365a7 Fix FSF address in license text according to
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@671 36d66b0a-2a48-0410-832c-cd162a569da5
2011-11-02 22:35:21 +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
39e6cfcb8a Use struct volume key thorough.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@571 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-17 22:35:30 +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