mirror of
https://github.com/openharmony/third_party_fsverity-utils.git
synced 2026-07-01 10:05:35 -04:00
cf8fa5e5a7
Add a 'fsverity dump_metadata' subcommand which calls FS_IOC_READ_VERITY_METADATA on a file and prints the returned metadata to stdout. There are three subsubcommands, one for each type of metadata that can be read using the ioctl: fsverity dump_metadata merkle_tree FILE fsverity dump_metadata descriptor FILE fsverity dump_metadata signature FILE By default the whole metadata item is dumped. --length and --offset can be specified to dump only a particular range of the item. This subcommand will be used by xfstests to test the FS_IOC_READ_VERITY_METADATA ioctl. Link: https://lore.kernel.org/r/20210115182402.35691-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com>
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Private header for the 'fsverity' program
|
|
*
|
|
* Copyright 2018 Google LLC
|
|
*
|
|
* Use of this source code is governed by an MIT-style
|
|
* license that can be found in the LICENSE file or at
|
|
* https://opensource.org/licenses/MIT.
|
|
*/
|
|
#ifndef PROGRAMS_FSVERITY_H
|
|
#define PROGRAMS_FSVERITY_H
|
|
|
|
#include "utils.h"
|
|
#include "../common/fsverity_uapi.h"
|
|
|
|
/*
|
|
* Largest digest size among all hash algorithms supported by fs-verity.
|
|
* This can be increased if needed.
|
|
*/
|
|
#define FS_VERITY_MAX_DIGEST_SIZE 64
|
|
|
|
enum {
|
|
OPT_BLOCK_SIZE,
|
|
OPT_CERT,
|
|
OPT_COMPACT,
|
|
OPT_FOR_BUILTIN_SIG,
|
|
OPT_HASH_ALG,
|
|
OPT_KEY,
|
|
OPT_LENGTH,
|
|
OPT_OFFSET,
|
|
OPT_SALT,
|
|
OPT_SIGNATURE,
|
|
};
|
|
|
|
struct fsverity_command;
|
|
|
|
/* cmd_digest.c */
|
|
int fsverity_cmd_digest(const struct fsverity_command *cmd,
|
|
int argc, char *argv[]);
|
|
|
|
/* cmd_dump_metadata.c */
|
|
int fsverity_cmd_dump_metadata(const struct fsverity_command *cmd,
|
|
int argc, char *argv[]);
|
|
|
|
/* cmd_enable.c */
|
|
int fsverity_cmd_enable(const struct fsverity_command *cmd,
|
|
int argc, char *argv[]);
|
|
|
|
/* cmd_measure.c */
|
|
int fsverity_cmd_measure(const struct fsverity_command *cmd,
|
|
int argc, char *argv[]);
|
|
|
|
/* cmd_sign.c */
|
|
int fsverity_cmd_sign(const struct fsverity_command *cmd,
|
|
int argc, char *argv[]);
|
|
|
|
/* fsverity.c */
|
|
void usage(const struct fsverity_command *cmd, FILE *fp);
|
|
bool parse_tree_param(int opt_char, const char *arg,
|
|
struct libfsverity_merkle_tree_params *params);
|
|
void destroy_tree_params(struct libfsverity_merkle_tree_params *params);
|
|
|
|
#endif /* PROGRAMS_FSVERITY_H */
|