Skip to content

Commit

Permalink
[pentest] Batch mode for Ibex SCA
Browse files Browse the repository at this point in the history
This commit adds the following new FI and SCA ibex tests:
- ibex_sca_tl_write_batch_fvsr
- ibex_sca_tl_write_batch_fvsr_fix_address
- ibex_sca_tl_write_batch_random
- ibex_sca_tl_write_batch_random_fix_address
- ibex_sca_tl_write_fvsr
- ibex_sca_tl_write_random
- ibex_sca_tl_read_batch_fvsr
- ibex_sca_tl_read_batch_fvsr_fix_address
- ibex_sca_tl_read_batch_random
- ibex_sca_tl_read_batch_random_fix_address
- ibex_sca_tl_read_fvsr
- ibex_sca_tl_read_random
- ibex_sca_register_file_write_batch_fvsr
- ibex_sca_register_file_write_batch_random
- ibex_sca_register_file_write_fvsr
- ibex_sca_register_file_write_random
- ibex_sca_register_file_read_batch_fvsr
- ibex_sca_register_file_read_batch_random
- ibex_sca_register_file_read_fvsr
- ibex_sca_register_file_read_random
- ibex_fi_char_sram_static

The host code is located in lowRISC/ot-sca#349

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed Mar 29, 2024
1 parent c262a00 commit 1faf819
Show file tree
Hide file tree
Showing 9 changed files with 1,177 additions and 354 deletions.
2 changes: 2 additions & 0 deletions sw/device/sca/lib/prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ __attribute__((noinline)) static uint32_t genrand_int32(void) {

void prng_seed(uint32_t seed) { init_by_array(&seed, 1); }

uint32_t prng_rand_uint32(void) { return genrand_int32(); }

uint8_t prng_rand_byte(void) {
uint32_t rand = 0;
do {
Expand Down
10 changes: 10 additions & 0 deletions sw/device/sca/lib/prng.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ extern "C" {
*/
void prng_seed(uint32_t seed);

/**
* Generates a random uint32_t.
*
* The behavior of this function matches the behavior of `random.randint(0,
* 0xFFFFFFFF)` in python.
*
* @return A random uint32_t.
*/
uint32_t prng_rand_uint32(void);

/**
* Generates a random byte.
*
Expand Down
12 changes: 4 additions & 8 deletions sw/device/tests/crypto/cryptotest/firmware/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ cc_library(
cc_library(
name = "ibex_fi",
srcs = ["ibex_fi.c"],
hdrs = [
"ibex_fi.h",
"status.h",
],
hdrs = ["ibex_fi.h"],
deps = [
"//sw/device/lib/base:memory",
"//sw/device/lib/base:status",
Expand All @@ -191,16 +188,15 @@ cc_library(
cc_library(
name = "ibex_sca",
srcs = ["ibex_sca.c"],
hdrs = [
"ibex_sca.h",
"status.h",
],
hdrs = ["ibex_sca.h"],
deps = [
"//sw/device/lib/base:memory",
"//sw/device/lib/base:status",
"//sw/device/lib/runtime:log",
"//sw/device/lib/testing/test_framework:check",
"//sw/device/lib/testing/test_framework:ujson_ottf",
"//sw/device/lib/ujson",
"//sw/device/sca/lib:prng",
"//sw/device/sca/lib:sca",
"//sw/device/tests/crypto/cryptotest/firmware:sca_lib",
"//sw/device/tests/crypto/cryptotest/json:ibex_sca_commands",
Expand Down
Loading

0 comments on commit 1faf819

Please sign in to comment.