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