linux/drivers/md/dm-verity-verify-sig.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2019 Microsoft Corporation.
 *
 * Author:  Jaskaran Singh Khurana <[email protected]>
 *
 */
#ifndef DM_VERITY_SIG_VERIFICATION_H
#define DM_VERITY_SIG_VERIFICATION_H

#define DM_VERITY_ROOT_HASH_VERIFICATION
#define DM_VERITY_ROOT_HASH_VERIFICATION_OPT_SIG_KEY

struct dm_verity_sig_opts {};

#ifdef CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG

#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS

int verity_verify_root_hash(const void *data, size_t data_len,
			    const void *sig_data, size_t sig_len);
bool verity_verify_is_sig_opt_arg(const char *arg_name);

int verity_verify_sig_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
				    struct dm_verity_sig_opts *sig_opts,
				    unsigned int *argc, const char *arg_name);

void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts);

#else

#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS

static inline int verity_verify_root_hash(const void *data, size_t data_len,
					  const void *sig_data, size_t sig_len)
{
	return 0;
}

static inline bool verity_verify_is_sig_opt_arg(const char *arg_name)
{
	return false;
}

static inline int verity_verify_sig_parse_opt_args(struct dm_arg_set *as,
			struct dm_verity *v, struct dm_verity_sig_opts *sig_opts,
			unsigned int *argc, const char *arg_name)
{
	return -EINVAL;
}

static inline void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts)
{
}

#endif /* CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG */
#endif /* DM_VERITY_SIG_VERIFICATION_H */