blob: dc8f35259369802d0888c0b1ecd71d4399489504 [file] [log] [blame]
// 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_CRYPTO_IMPL_INTEGRITY_CHECK_H_
#define OPENTITAN_SW_DEVICE_LIB_CRYPTO_IMPL_INTEGRITY_CHECK_H_
#include <stddef.h>
#include <stdint.h>
#include "sw/device/lib/base/hardened.h"
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/crypto/include/datatypes.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
* Perform an integrity check on the unblinded key.
*
* Returns `kHardenedBoolTrue` if the check passed and `kHardenedBoolFalse`
* otherwise.
*
* @param key Unblinded key.
* @returns Whether the integrity check passed.
*/
OT_WARN_UNUSED_RESULT
hardened_bool_t unblinded_key_integrity_check(
const crypto_unblinded_key_t *key);
/**
* Perform an integrity check on the blinded key.
*
* Returns `kHardenedBoolTrue` if the check passed and `kHardenedBoolFalse`
* otherwise.
*
* @param key Blinded key.
* @returns Whether the integrity check passed.
*/
OT_WARN_UNUSED_RESULT
hardened_bool_t blinded_key_integrity_check(const crypto_blinded_key_t *key);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // OPENTITAN_SW_DEVICE_LIB_CRYPTO_IMPL_INTEGRITY_CHECK_H_