// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_KMAC_TESTUTILS_H_
#define OPENTITAN_SW_DEVICE_LIB_TESTING_KMAC_TESTUTILS_H_

#include "sw/device/lib/dif/dif_kmac.h"

/**
 * Configure the KMAC block.
 *
 * This is a thin wrapper around `dif_kmac_configure`. It sets up a testing
 * configuration that prioritizes speed over security, since we don't care
 * about protecting test keys. For instance, it sets the entropy source to
 * software so KMAC doesn't wait for fresh entropy, and minimizes masking.
 *
 * @param kmac KMAC context
 * @param sideload Whether to configure KMAC to read a sideloaded key.
 */
void kmac_testutils_config(dif_kmac_t *kmac, bool sideload);

/**
 * Runs the full KMAC operation.
 *
 * Assumes that the KMAC block has already been initialized and configured, and
 * that the sideloaded key has been loaded (if applicable).
 *
 * @param kmac KMAC block context
 * @param mode Mode (security strength) for KMAC
 * @param key KMAC key
 * @param custom_string Customization string
 * @param custom_string_len Length of customization string
 * @param message Input message
 * @param message_len Length of message in bytes
 * @param output_len Requested length of output in words
 * @param output Pre-allocated output buffer (length must match output_len)
 */
void kmac_testutils_kmac(const dif_kmac_t *kmac, dif_kmac_mode_kmac_t mode,
                         const dif_kmac_key_t *key, const char *custom_string,
                         const size_t custom_string_len, const char *message,
                         const size_t message_len, const size_t output_len,
                         uint32_t *output);

#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_KMAC_TESTUTILS_H_
