Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library: Be more explicit about what kind of signatures/digest we mean #152

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libcomposefs/lcfs-mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ static int lcfs_validate_mount_options(struct lcfs_mount_state_s *state)
(!options->upperdir && options->workdir))
return -EINVAL;

if (options->expected_digest) {
int raw_len = digest_to_raw(options->expected_digest,
if (options->expected_fsverity_digest) {
int raw_len = digest_to_raw(options->expected_fsverity_digest,
state->expected_digest, MAX_DIGEST_SIZE);
if (raw_len < 0)
return -EINVAL;
Expand All @@ -254,8 +254,8 @@ static int lcfs_validate_verity_fd(struct lcfs_mount_state_s *state)
char sig_data[1];
struct fsverity_read_metadata_arg read_metadata = { 0 };

require_signature =
(state->options->flags & LCFS_MOUNT_FLAGS_REQUIRE_SIGNATURE) != 0;
require_signature = (state->options->flags &
LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE) != 0;
if (require_signature) {
/* First ensure fs-verity is enabled for the image,
* the actual digest doesn't matter at this point. */
Expand Down
4 changes: 2 additions & 2 deletions libcomposefs/lcfs-mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum lcfs_mount_flags_t {
LCFS_MOUNT_FLAGS_NONE = 0,
LCFS_MOUNT_FLAGS_REQUIRE_VERITY = (1 << 0),
LCFS_MOUNT_FLAGS_READONLY = (1 << 1),
LCFS_MOUNT_FLAGS_REQUIRE_SIGNATURE = (1 << 2),
LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE = (1 << 2),
LCFS_MOUNT_FLAGS_IDMAP = (1 << 3),
LCFS_MOUNT_FLAGS_DISABLE_VERITY = (1 << 4),

Expand All @@ -47,7 +47,7 @@ struct lcfs_mount_options_s {
size_t n_objdirs;
const char *workdir;
const char *upperdir;
const char *expected_digest;
const char *expected_fsverity_digest;
uint32_t flags;
int idmap_fd; /* userns fd */
const char *image_mountdir; /* Temporary location to mount images if needed */
Expand Down
4 changes: 2 additions & 2 deletions tools/mountcomposefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int main(int argc, char **argv)
options.upperdir = opt_upperdir;
options.workdir = opt_workdir;

options.expected_digest = opt_digest;
options.expected_fsverity_digest = opt_digest;

if (opt_verity && opt_noverity) {
printexit("Incompatible options verity, noverity\n");
Expand All @@ -240,7 +240,7 @@ int main(int argc, char **argv)
if (opt_noverity)
options.flags |= LCFS_MOUNT_FLAGS_DISABLE_VERITY;
if (opt_signed)
options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_SIGNATURE;
options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE;
if (opt_ro)
options.flags |= LCFS_MOUNT_FLAGS_READONLY;

Expand Down