Software APIs
mock_rv_core_ibex.cc
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
6#include "sw/device/lib/crypto/drivers/rv_core_ibex.h"
7#include "sw/device/lib/crypto/impl/status.h"
8
9namespace test {
10extern "C" {
11
12hardened_bool_t ibex_check_security_config(void) { return kHardenedBoolTrue; }
13
14status_t ibex_set_security_config(void) { return OTCRYPTO_OK; }
15
16status_t ibex_disable_icache(hardened_bool_t *icache_enabled) {
17 return OTCRYPTO_OK;
18}
19
20void ibex_restore_icache(hardened_bool_t icache_enabled) {
21 asm volatile("nop");
22}
23
24// Since this mock library is for tests only, the randomness does not need to be
25// real. https://xkcd.com/221/
26uint32_t ibex_rnd32_read(void) { return 4; }
27
28void ibex_clear_rf(void) { asm volatile("nop"); }
29
30uint32_t hardened_memshred_random_word(void) { return ibex_rnd32_read(); }
31
32uint32_t random_order_random_word(void) { return ibex_rnd32_read(); }
33}
34} // namespace test