Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pentest] Add Ibex FI & SCA tests #22269

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions sw/device/tests/crypto/cryptotest/firmware/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,13 @@ cc_library(

cc_library(
name = "ibex_fi",
srcs = ["ibex_fi.c"],
hdrs = [
"ibex_fi.h",
"status.h",
srcs = [
"ibex_fi.S",
"ibex_fi.c",
],
hdrs = ["ibex_fi.h"],
deps = [
"//sw/device/lib/base:csr",
"//sw/device/lib/base:memory",
"//sw/device/lib/base:status",
"//sw/device/lib/dif:flash_ctrl",
Expand All @@ -191,14 +192,14 @@ 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/dif:keymgr",
"//sw/device/lib/dif:kmac",
"//sw/device/lib/runtime:log",
"//sw/device/lib/testing:keymgr_testutils",
"//sw/device/lib/testing/test_framework:ujson_ottf",
"//sw/device/lib/ujson",
"//sw/device/sca/lib:sca",
Expand Down
234 changes: 234 additions & 0 deletions sw/device/tests/crypto/cryptotest/firmware/ibex_fi.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

/**
* Increments a value 100 times by 1.
*
* As this function is targeted by fault injection, the code is unrolled.
*
* @param a0 initial value which gets incremented.
timothytrippel marked this conversation as resolved.
Show resolved Hide resolved
* @return Initial value incremeted 100 times by 1.
*/
.globl increment_100x1
.type increment_100x1, @function
.balign 256
increment_100x1:
// a0: init value
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
addi a0, a0, 1
ret


/**
* Increments a value 100 times by 10.
*
* As this function is targeted by fault injection, the code is unrolled.
*
* @param a0 initial value which gets incremented.
* @return Initial value incremeted 100 times by 10.
*/
.globl increment_100x10
.type increment_100x10, @function
.balign 256
increment_100x10:
// a0: init value
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
addi a0, a0, 10
ret
Loading
Loading