Commit Graph
66931 Commits
Author SHA1 Message Date
Dan Streetman 3f4d5dfd65 tpm2: use switch() instead of if-else 2023-08-24 12:35:58 -04:00
Dan Streetman 6761e1355e tpm2: use table for openssl<->tpm2 ecc curve id mappings 2023-08-24 12:35:54 -04:00
Dan Streetman b030710295 openssl: use new(char, size) instead of malloc(size) 2023-08-24 12:33:26 -04:00
Dan Streetman 65fd657e0a tpm2: use memcpy_safe() instead of memcpy() 2023-08-24 12:33:26 -04:00
Dan Streetman ae2b38e463 tpm2: remove ret_ prefix from input/output params 2023-08-24 12:33:26 -04:00
Dan Streetman c6e5178220 tpm2: split TPM2_PCR_VALUE_MAKE() over multiple lines 2023-08-24 12:33:26 -04:00
Dan Streetman 85b6f299b2 tpm2: use strempty() 2023-08-24 12:33:26 -04:00
Dan Streetman 8e757259c3 tpm2: check pcr value hash != 0 before looking up hash algorithm name 2023-08-24 12:33:26 -04:00
Dan Streetman 495f2bf57c tpm2: simplify call to asprintf() 2023-08-24 12:33:26 -04:00
Dan Streetman 2b2ee3f265 tpm2: put !isempty() check inside previous !isempty() check 2023-08-24 12:33:26 -04:00
Dan Streetman 7001a7daf7 tpm2: use SIZE_MAX instead of strlen() for unhexmem() 2023-08-24 12:33:26 -04:00
Dan Streetman 193fd5730e tpm2: in tpm2_pcr_values_valid() use FOREACH_ARRAY() 2023-08-24 12:32:51 -04:00
Dan Streetman 064ac95d81 tpm2: in validator functions, return false instead of assert failure 2023-08-24 12:31:00 -04:00
Dan Streetman 3cd4145f34 tpm2: move cast from lhs to rhs in uint16_t/int comparison 2023-08-24 12:31:00 -04:00
Dan Streetman cc1a78d5c4 tpm2: lowercase TPM2_PCR_VALUE[S]_VALID functions
As these are not macros, they should be lowercase.
2023-08-24 12:31:00 -04:00
Dan Streetman 7354a7ccd4 tpm2: change *alg_to_* functions to use switch() 2023-08-24 12:31:00 -04:00
Zbigniew Jędrzejewski-Szmek ebbc92405b Merge pull request #28917 from yuwata/network-address-pool
undefined
2023-08-24 15:58:31 +02:00
Yu Watanabe 927e20fa49 nspawn: check validity of the internal interface name only explicitly specified
Follow-up for 2f091b1b49.

Fixes #28844.
2023-08-24 15:55:32 +02:00
Zbigniew Jędrzejewski-Szmek 6d9829e724 man/repart: use <filename> and add missing <para> 2023-08-24 15:45:24 +02:00
Zbigniew Jędrzejewski-Szmek 12455d6e87 Merge pull request #28918 from yuwata/network-dhcp-custom-duid
network/dhcp: allow to specify custom duid type
2023-08-24 15:45:07 +02:00
Lennart Poettering 6b0651df60 gpt: move basic header/partition structure of GPT into common code
This way we can use it at other places too, not just when dissecting
images.
2023-08-24 15:25:38 +02:00
Lennart Poettering 24ae45cb65 alloc-util: add free_many() helper
We often free an array of things. Let's create a common helper for this,
and port some potential users over. (Not all, too lazy for that for
now).
2023-08-24 15:04:33 +02:00
Lennart Poettering a16e19c61d Merge pull request #28946 from poettering/json-variant-append-arrayb
add json_variant_append_arrayb() helper + more related
2023-08-24 13:37:10 +02:00
Lennart Poettering f5fc7732b0 json: add json_variant_set_fieldb() helper
Let's a "b" helper for json_variant_set_field() that combines
json_build() with json_variant_set_field(), similar to the
json_variant_merge_objectb(), json_variant_append_arrayb().
2023-08-24 13:20:39 +02:00
Lennart Poettering e931768eb4 json: rename json_append() → json_variant_merge_objectb()
json_append() is a useful wrapper around json_variant_merge(). However,
I think the naming sould be cleaned up a bit of both functions.

I thinker "merge" is the better word than "append", since it does
decidedly more than just append: it replaces existing fields of the same
name, hence "merge" sounds more appropriate. This is as opposed to the
similar operations for arrays, where no such override logic is applied
and we really just append, hence those functions are called "append"
already.

To make clearer that "merge" is about objects, and "append" about
arrays, also include "object" in the name.

Also, include "json_variant" in the name, like we do for almost all
other functions in the JSON API that take a JSON object as primary
input, and hence are kinda object methods.

Finally, let's follow the logic that helpers that combine json_build()
with some other operation get suffixed with "b" like we already have in
some cases.

Hence:

json_variant_merge() → json_variant_merge_object()
       json_append() → json_variant_merge_objectb()

This mirrors nicely the existing:
                       json_variant_append_array()
                       json_vairant_append_arrayb()

This also drops the variant of json_append() that takes a va_arg
parameter (i.e. json_appendv()). We have no user of that so far, and
given the nature as a helper function only I don#t see that happening,
and if it happens after all it's trivial to bring back.
2023-08-24 13:20:39 +02:00
Lennart Poettering c91f581c47 tree-wide: use json_variant_append_arrayb() at many places 2023-08-24 13:19:52 +02:00
Lennart Poettering 3218794f1c json: add json_variant_append_arrayb() helper 2023-08-24 13:19:52 +02:00
Lennart Poettering ba091282e5 utf8: automatically determine length of string if SIZE_MAX is specified
Let's make utf8_to_utf16() and utf16_to_utf8() a bit nicer to use by
adding shortcuts for common cases.

This is particularly relevant for utf16_to_utf8() since the
multiplication with 2 is easy to forget.
2023-08-24 13:19:12 +02:00
Susant Sahani e448fcd01a test-network: re-add test for custom client identifier 2023-08-24 19:55:31 +09:00
Yu Watanabe 80500bb5d4 network/dhcp: make DUIDType= take an arbitrary integer
Closes #26745.
2023-08-24 19:55:27 +09:00
Yu Watanabe 2da796cabb dhcp: DUID-EN identifier has variable length
Also make `array[0]` -> `array[]`.

See RFC 8415, section 11.3.
2023-08-24 19:52:35 +09:00
Yu Watanabe 9291496011 network/dhcp: fix maximal DUID data size
The maximum DUID size is 128, but that includes type specified.
Hence, the maximal data size is 126.
2023-08-24 19:50:37 +09:00
Yu Watanabe 53488ea352 network: introduce per DUID type setters
No functional change, just refactoring.
2023-08-24 19:50:36 +09:00
Yu Watanabe 6ed69be98a Revert "network: DHCP6 client- Allow to send manual DUID"
This reverts commits 89e73ce86f and
543d2a4d45.

The commit assign "custom" to fixed DUID type 5. When making DUID fully
configurable, the type number should be also configurable. Also, the
fully custom DUID should be acceptable for DHCPv4.
2023-08-24 19:50:36 +09:00
Daan De Meyer b56ee69233 hostname: Make sure we pass error to bus_verify_polkit_async()
Fixes #28943
2023-08-24 11:23:01 +02:00
Zbigniew Jędrzejewski-Szmek c9c4e599fc Merge pull request #24175 from medhefgo/meson-feature
meson: Use feature options
2023-08-24 11:19:55 +02:00
Zbigniew Jędrzejewski-Szmek c31ba5cfe9 meson: use 'sh' variable everywhere
We went back-and-forth a bit on this. Very old meson would print a message
about detecting the program if a quoted argument was used, leading to a lot of
noise. So we started to convert various places to use the variable, but then it
turned out that meson < 0.56.2 doesn't handle this correctly and we reverted to
using strings everywhere in 7c22f07cbd. Then at
some point we stopped supporting old meson and over time we started using the
variable in various places again, somewhat inconsistently. Then most calls to
'sh' were removed in 9289e093ae when
install_emptydir() builtin started being used.

Now meson allows either the string or variable to be used, and doesn't print a
message if the string is used. Let's use the variable everywhere. For 'sh', we
could do either, but for other variables, we _do_ want the detection to happen,
for example for git, find, awk, which might not be installed and we want to
detect that early, before we start the build. It would be ugly to use quotes
for some programs, but not for others. Also, a string is still refused for
test(), so we couldn't use the string version even if we didn't care about
detection.
2023-08-24 11:17:50 +02:00
Daan De Meyer 799cd3100b repart: Make verity example more useful
Add Minimize= so the size gets calculated correctly and add a verity
signature partition as well for completeness.
2023-08-24 10:43:11 +02:00
Frantisek Sumsal 9541addff0 test: use the correct file name when restoring the original fstab 2023-08-24 07:54:13 +00:00
Daan De Meyer 1ffa5cfb38 repart: Add partno to output 2023-08-23 15:12:23 +02:00
Daan De Meyer 9f643be929 mkosi: Drop fedora workaround
Seems the key issues got resolved so let's drop the workaround.
2023-08-23 15:10:46 +02:00
Jan Janssen 2d7c857d9c meson: Simplify efi test/fuzz definitions 2023-08-23 14:58:04 +02:00
Jan Janssen 7f9a0d6d74 meson: Drop skip-deps option
Now that we use meson feature options for our dependencies, we can just
rely on '--auto-features=disabled' to do the same. One benefit of this
is that specific features can still be force-enabled by overriding it
with the appropriate '-Dfeature=enabled' flag.

The two remaining uses for skip-deps can simply rely on their default
logic that sets the value to 'no' when the dependency is disabled.
2023-08-23 14:57:49 +02:00
Jan Janssen 1e73a64a7a meson: Convert more options to meson features
The semantics for libidn2 and pwquality have changed slightly: We will
pick a preferred one if both are enabled instead of making it an error.
2023-08-23 14:45:02 +02:00
Jan Janssen 847e5585b6 meson: Convert bpf-framework to meson feature 2023-08-23 14:45:02 +02:00
Jan Janssen 40e9c4e45d meson: Convert options to meson features (require)
These options use requre() to conveniently express their dependency
requirements.
2023-08-23 14:45:02 +02:00
Jan Janssen 101b59433b meson: Convert dbus to meson feature
Also, there is no need to conditionalize the get_variable() calls
because not-found dependencies will just return the passed default value
if provided.
2023-08-23 14:45:02 +02:00
Jan Janssen a0c9ac9ae4 meson: Convert options to meson features (find_library fallback)
This uses a two-step approach to make sure we can fall back to
find_library(), while also skipping the detection if the features are
explicitly disabled.
2023-08-23 14:45:02 +02:00
Jan Janssen 9ee80846f8 meson: Convert fidsk to meson feature
By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
2023-08-23 14:45:02 +02:00
Jan Janssen 43abc59a27 meson: Use feature options
By using meson features we can replace the handcrafted dependency
auto-detection by just passing the value from get_option directly to the
required arg for dependency, find_library etc.
'auto' features make the dependency optional, 'enabled' requires it
while 'disabled' features will skip detection entirely.

Any skipped or not found dependency will just be a no-op when passed to
build steps and therefore we can also skip the creation of empty vars.

The use of skip_deps for these is dropped here as meson provides a way
to disable all optional features in one go by passing
'-Dauto_features=disabled'.
2023-08-23 14:45:02 +02:00