1ced56a00Sopenharmony_ci/* SPDX-License-Identifier: MIT */
2ced56a00Sopenharmony_ci/*
3ced56a00Sopenharmony_ci * Private header for the 'fsverity' program
4ced56a00Sopenharmony_ci *
5ced56a00Sopenharmony_ci * Copyright 2018 Google LLC
6ced56a00Sopenharmony_ci *
7ced56a00Sopenharmony_ci * Use of this source code is governed by an MIT-style
8ced56a00Sopenharmony_ci * license that can be found in the LICENSE file or at
9ced56a00Sopenharmony_ci * https://opensource.org/licenses/MIT.
10ced56a00Sopenharmony_ci */
11ced56a00Sopenharmony_ci#ifndef PROGRAMS_FSVERITY_H
12ced56a00Sopenharmony_ci#define PROGRAMS_FSVERITY_H
13ced56a00Sopenharmony_ci
14ced56a00Sopenharmony_ci#include "utils.h"
15ced56a00Sopenharmony_ci#include "../common/fsverity_uapi.h"
16ced56a00Sopenharmony_ci
17ced56a00Sopenharmony_ci/*
18ced56a00Sopenharmony_ci * Largest digest size among all hash algorithms supported by fs-verity.
19ced56a00Sopenharmony_ci * This can be increased if needed.
20ced56a00Sopenharmony_ci */
21ced56a00Sopenharmony_ci#define FS_VERITY_MAX_DIGEST_SIZE	64
22ced56a00Sopenharmony_ci
23ced56a00Sopenharmony_cienum {
24ced56a00Sopenharmony_ci	OPT_BLOCK_SIZE,
25ced56a00Sopenharmony_ci	OPT_CERT,
26ced56a00Sopenharmony_ci	OPT_COMPACT,
27ced56a00Sopenharmony_ci	OPT_FOR_BUILTIN_SIG,
28ced56a00Sopenharmony_ci	OPT_HASH_ALG,
29ced56a00Sopenharmony_ci	OPT_KEY,
30ced56a00Sopenharmony_ci	OPT_LENGTH,
31ced56a00Sopenharmony_ci	OPT_OFFSET,
32ced56a00Sopenharmony_ci	OPT_OUT_DESCRIPTOR,
33ced56a00Sopenharmony_ci	OPT_OUT_MERKLE_TREE,
34ced56a00Sopenharmony_ci	OPT_PKCS11_ENGINE,
35ced56a00Sopenharmony_ci	OPT_PKCS11_KEYID,
36ced56a00Sopenharmony_ci	OPT_PKCS11_MODULE,
37ced56a00Sopenharmony_ci	OPT_SALT,
38ced56a00Sopenharmony_ci	OPT_SIGNATURE,
39ced56a00Sopenharmony_ci};
40ced56a00Sopenharmony_ci
41ced56a00Sopenharmony_cistruct fsverity_command;
42ced56a00Sopenharmony_ci
43ced56a00Sopenharmony_ci/* cmd_digest.c */
44ced56a00Sopenharmony_ciint fsverity_cmd_digest(const struct fsverity_command *cmd,
45ced56a00Sopenharmony_ci			int argc, char *argv[]);
46ced56a00Sopenharmony_ci
47ced56a00Sopenharmony_ci/* cmd_dump_metadata.c */
48ced56a00Sopenharmony_ciint fsverity_cmd_dump_metadata(const struct fsverity_command *cmd,
49ced56a00Sopenharmony_ci			       int argc, char *argv[]);
50ced56a00Sopenharmony_ci
51ced56a00Sopenharmony_ci/* cmd_enable.c */
52ced56a00Sopenharmony_ciint fsverity_cmd_enable(const struct fsverity_command *cmd,
53ced56a00Sopenharmony_ci			int argc, char *argv[]);
54ced56a00Sopenharmony_ci
55ced56a00Sopenharmony_ci/* cmd_measure.c */
56ced56a00Sopenharmony_ciint fsverity_cmd_measure(const struct fsverity_command *cmd,
57ced56a00Sopenharmony_ci			 int argc, char *argv[]);
58ced56a00Sopenharmony_ci
59ced56a00Sopenharmony_ci/* cmd_sign.c */
60ced56a00Sopenharmony_ciint fsverity_cmd_sign(const struct fsverity_command *cmd,
61ced56a00Sopenharmony_ci		      int argc, char *argv[]);
62ced56a00Sopenharmony_ci
63ced56a00Sopenharmony_ci/* fsverity.c */
64ced56a00Sopenharmony_civoid usage(const struct fsverity_command *cmd, FILE *fp);
65ced56a00Sopenharmony_cibool parse_tree_param(int opt_char, const char *arg,
66ced56a00Sopenharmony_ci		      struct libfsverity_merkle_tree_params *params);
67ced56a00Sopenharmony_cibool destroy_tree_params(struct libfsverity_merkle_tree_params *params);
68ced56a00Sopenharmony_ci
69ced56a00Sopenharmony_ci#endif /* PROGRAMS_FSVERITY_H */
70