Commit Graph

66556 Commits

Author SHA1 Message Date
Frantisek Sumsal
04bce24d4e test: ignore missing libudev when creating the test image
Same scenario as with libsystemd - ldd might use unprefixed RPATH, and
we install our own stuff into the image unconditionally anyway.

Also, bail out early if we hit a missing DSO with a possibly helpful
message.
2023-08-05 13:32:17 +09:00
Dan Streetman
9afd4dde22 tpm2: use ELEMENTSOF() instead of sizeof() for TPML_PCR_SELECTION pcrSelections field
The count field indicates the number of elements in the pcrSelections field,
and the size of each elements is greater than 1 byte, so using sizeof() is
incorrect when verifying the count field is valid; instead ELEMENTSOF() should
be used.

Caught by coverity check: https://github.com/systemd/systemd/pull/26331#pullrequestreview-1556629586
2023-08-05 13:31:59 +09:00
Yu Watanabe
42f13f10d5 Merge pull request #28681 from yuwata/udev-vs-tmpfiles
Udev vs tmpfiles
2023-08-05 13:30:49 +09:00
Luca Boccassi
06e8f7af7b Merge pull request #28398 from ddstreet/tpm2_specify_pcr_value
Tpm2 specify pcr value
2023-08-04 21:04:03 +01:00
Yu Watanabe
23acdb8d0b test: shorten timeout for 'udevadm monitor'
The command should never finish, it is not necessary to wait so long.
2023-08-05 05:03:20 +09:00
Yu Watanabe
b768379e8b test: add short test for device node permission 2023-08-05 04:52:16 +09:00
Yu Watanabe
31845ef554 unit: make udev rules take precesence over tmpfiles
Without this change, there are no ordering between udevd and tmpfiles,
and if tmpfiles is invoked later it may discard the permission set by
udevd.

Fixes an issue introduced by b42482af90.

Fixes #28588 and #28653.
2023-08-05 04:38:39 +09:00
Yu Watanabe
33b91308c2 Revert "tmpfiles.d: adjust /dev/vfio/vfio access mode"
The issue needs to be fixed by setting proper ordering between the
tmpfiles and udevd.

See issue #28653, especially
https://github.com/systemd/systemd/issues/28653#issuecomment-1665181625.

This reverts commit a3d610998a.
2023-08-05 04:32:01 +09:00
Zbigniew Jędrzejewski-Szmek
8cb0008977 journalctl: fix loggging invocation
Fixup for f882a986c2.
2023-08-04 20:21:13 +01:00
Luca Boccassi
7f878268ff Merge pull request #28679 from keszybz/two-new-news-tweaks
Two news tweaks
2023-08-04 19:24:46 +01:00
Daan De Meyer
73e6b6974b Merge pull request #28669 from DaanDeMeyer/mkosi-fix
mkosi: Make sure our systemd build always overrides the distros
2023-08-04 20:16:55 +02:00
Daan De Meyer
5dd814d7cd tmpfiles: Consider ENOPKG as information not available
We already handle the case where /etc/machine-id is empty. Let's make
sure we also handle the case where /etc/machine-id is "uninitialized".
2023-08-04 20:16:23 +02:00
Luca Boccassi
bdfa3f3a5c portablectl: fix regression when using --force without extension parameters
c18f4eb9e9 made it possible to use --force with various verbs, by
going through the newer D-Bus methods. Except it didn't, as it regressed
during PR review refactorings, and nobody noticed because there were no
tests for it. Fix it, and add tests.

Follow-up for c18f4eb9e9
2023-08-04 18:29:57 +01:00
Luca Boccassi
0e387e1295 Merge pull request #28673 from YHNdnzj/hibernate-resume-escape-node
hibernate-resume-generator: escape device path passed to hibernate-resume
2023-08-04 16:46:56 +01:00
Dan Streetman
e85ddd9644 tpm2: update TEST-70-TPM2 to test passing PCR value to systemd-cryptenroll
Add tests to use expected, not current, PCR values during sealing.
2023-08-04 11:20:33 -04:00
Dan Streetman
1782b0b88c man: update systemd-cryptenroll man page with details on --tpm2-pcrs format change
The previous commit extended the accepted format of --tpm2-pcrs to allow
specifying the hash algorithm (i.e. PCR bank) and hash digest value, this
updates the man page with those changes.
2023-08-04 11:20:31 -04:00
Dan Streetman
9e4379945b tpm2: move policy calculation out of tpm2_seal()
Move the calculation of the sealed object policy hash out of the tpm2_seal()
function. Instead, callers of tpm2_seal() can directly call
tpm2_calculate_sealing_policy() and then provide the policy hash to
tpm2_seal().
2023-08-04 11:20:22 -04:00
Dan Streetman
e3acb4d24c tpm2: add functions to convert TPM2B_PUBLIC to/from openssl pkey or PEM
Add functions to convert a PEM or pkey to TPM2B_PUBLIC, and functions to
convert TPM2B_PUBLIC to pkey or fingerprint.

Supports both RSA and ECC keys.

Add ECC support to some test-tpm2 tests, and tests to cover the newly added functions.
2023-08-04 11:19:54 -04:00
Dan Streetman
cffeee92bb openssl: add test-openssl
Add openssl unit tests.
2023-08-04 11:18:14 -04:00
Dan Streetman
0fdcfa7812 test: add DEFINE_HEX_PTR() helper function
Use function in test-tpm2 to convert hex strings to void* and len vars.
2023-08-04 10:57:08 -04:00
Dan Streetman
900e73f80e openssl: add ecc_pkey_new(), ecc_pkey_from_curve_x_y(), ecc_pkey_to_curve_x_y()
Add function to create openssl pkey from ECC curve and point, and function to
get curve id and x/y point from existing ECC pkey. Also add function to create
new ECC key for specified curve.

Also add DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_MACRO() to handle case when func() is
a macro, not a function symbol; specifically in this case it is used for
OPENSSL_free() which is a macro.
2023-08-04 10:57:08 -04:00
Dan Streetman
dcec950ca1 openssl: add rsa_pkey_new(), rsa_pkey_from_n_e(), rsa_pkey_to_n_e()
Add function to generate an EVP_PKEY for a specific 'n' and 'e', and function
to get 'n' and 'e' values from existing RSA public key. Also add a function to
generate a new RSA key with a specified number of bits.
2023-08-04 10:57:07 -04:00
Dan Streetman
4af788c70c openssl: add openssl_pkey_from_pem()
Add function to create EVP_PKEY from PEM buffer.
2023-08-04 10:57:07 -04:00
Dan Streetman
b4a6fcd5c5 tpm2: add tpm2_pcr_read_missing_values()
Add function to read all unset values in an array of Tpm2PCRValue entries.

Also publish tpm2_pcr_read() in header.
2023-08-04 10:57:07 -04:00
Dan Streetman
53b91e1981 tpm2: add TPM2B_*_MAKE(), TPM2B_*_CHECK_SIZE() macros
The tpm2-tss library has many structs with only an array and size; these macros
make it easy to assign to these structs.
2023-08-04 10:57:07 -04:00