1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019 Microsoft Corporation.
5 * Author: Jaskaran Singh Khurana <jaskarankhurana@linux.microsoft.com>
8 #ifndef DM_VERITY_SIG_VERIFICATION_H
9 #define DM_VERITY_SIG_VERIFICATION_H
11 #define DM_VERITY_ROOT_HASH_VERIFICATION "DM Verity Sig Verification"
12 #define DM_VERITY_ROOT_HASH_VERIFICATION_OPT_SIG_KEY "root_hash_sig_key_desc"
14 struct dm_verity_sig_opts
{
15 unsigned int sig_size
;
19 #ifdef CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG
21 #define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 2
23 int verity_verify_root_hash(const void *data
, size_t data_len
,
24 const void *sig_data
, size_t sig_len
);
25 bool verity_verify_is_sig_opt_arg(const char *arg_name
);
27 int verity_verify_sig_parse_opt_args(struct dm_arg_set
*as
, struct dm_verity
*v
,
28 struct dm_verity_sig_opts
*sig_opts
,
29 unsigned int *argc
, const char *arg_name
);
31 void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts
*sig_opts
);
35 #define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 0
37 static inline int verity_verify_root_hash(const void *data
, size_t data_len
,
38 const void *sig_data
, size_t sig_len
)
43 static inline bool verity_verify_is_sig_opt_arg(const char *arg_name
)
48 static inline int verity_verify_sig_parse_opt_args(struct dm_arg_set
*as
,
49 struct dm_verity
*v
, struct dm_verity_sig_opts
*sig_opts
,
50 unsigned int *argc
, const char *arg_name
)
55 static inline void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts
*sig_opts
)
59 #endif /* CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG */
60 #endif /* DM_VERITY_SIG_VERIFICATION_H */