linux/security/ipe/digest.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2020-2024 Microsoft Corporation. All rights reserved.
 */

#include "digest.h"

/**
 * ipe_digest_parse() - parse a digest in IPE's policy.
 * @valstr: Supplies the string parsed from the policy.
 *
 * Digests in IPE are defined in a standard way:
 *	<alg_name>:<hex>
 *
 * Use this function to create a property to parse the digest
 * consistently. The parsed digest will be saved in @value in IPE's
 * policy.
 *
 * Return: The parsed digest_info structure on success. If an error occurs,
 * the function will return the error value (via ERR_PTR).
 */
struct digest_info *ipe_digest_parse(const char *valstr)
{}

/**
 * ipe_digest_eval() - evaluate an IPE digest against another digest.
 * @expected: Supplies the policy-provided digest value.
 * @digest: Supplies the digest to compare against the policy digest value.
 *
 * Return:
 * * %true	- digests match
 * * %false	- digests do not match
 */
bool ipe_digest_eval(const struct digest_info *expected,
		     const struct digest_info *digest)
{}

/**
 * ipe_digest_free() - free an IPE digest.
 * @info: Supplies a pointer the policy-provided digest to free.
 */
void ipe_digest_free(struct digest_info *info)
{}

/**
 * ipe_digest_audit() - audit a digest that was sourced from IPE's policy.
 * @ab: Supplies the audit_buffer to append the formatted result.
 * @info: Supplies a pointer to source the audit record from.
 *
 * Digests in IPE are audited in this format:
 *	<alg_name>:<hex>
 */
void ipe_digest_audit(struct audit_buffer *ab, const struct digest_info *info)
{}