-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pentest] OTBN FI key sideloading & load integrity
This commits adds the following two FI penetration tests for OTBN: - otbn.fi.load_integrity - otbn.fi.key_sideload The first test aims to check whether the CRC checksum over the DMEM can be manipulated. The second test aims to test whether a fault can manipulate a key that gets sideloaded from the key manager. Signed-off-by: Pascal Nasahl <[email protected]>
- Loading branch information
Showing
11 changed files
with
371 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
sw/device/tests/crypto/cryptotest/firmware/otbn/otbn_key_sideload.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Copyright lowRISC contributors. */ | ||
/* Licensed under the Apache License, Version 2.0, see LICENSE for details. */ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
/* | ||
OBTN.KEY_SIDELOAD FI Penetration Test | ||
*/ | ||
.section .text.start | ||
|
||
/* Load all key shares into w20...w23. */ | ||
bn.wsrr w20, KEY_S0_L | ||
bn.wsrr w21, KEY_S1_L | ||
bn.wsrr w22, KEY_S0_H | ||
bn.wsrr w23, KEY_S1_H | ||
|
||
/* Write key shared into accessible DMEM. */ | ||
li x2, 20 | ||
la x3, k_s0_l | ||
bn.sid x2, 0(x3) | ||
|
||
li x2, 21 | ||
la x3, k_s0_h | ||
bn.sid x2, 0(x3) | ||
|
||
li x2, 22 | ||
la x3, k_s1_l | ||
bn.sid x2, 0(x3) | ||
|
||
li x2, 23 | ||
la x3, k_s1_h | ||
bn.sid x2, 0(x3) | ||
|
||
ecall | ||
|
||
.data | ||
.globl k_s0_l | ||
.balign 32 | ||
k_s0_l: | ||
.zero 32 | ||
|
||
.globl k_s0_h | ||
.balign 32 | ||
k_s0_h: | ||
.zero 32 | ||
|
||
.globl k_s1_l | ||
.balign 32 | ||
k_s1_l: | ||
.zero 32 | ||
|
||
.globl k_s1_h | ||
.balign 32 | ||
k_s1_h: | ||
.zero 32 |
31 changes: 31 additions & 0 deletions
31
sw/device/tests/crypto/cryptotest/firmware/otbn/otbn_load_integrity.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright lowRISC contributors. */ | ||
/* Licensed under the Apache License, Version 2.0, see LICENSE for details. */ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
/* | ||
OBTN.LOAD_INTEGRITY FI Penetration Test | ||
*/ | ||
.section .text.start | ||
|
||
/* Execute 10 NOPs. */ | ||
li x1, 10 | ||
loop x1, 1 | ||
nop | ||
|
||
ecall | ||
|
||
.data | ||
/* Reference values. */ | ||
.balign 32 | ||
.globl refval1 | ||
refval1: | ||
.word 0x1BADB002 | ||
|
||
.balign 32 | ||
.globl refval2 | ||
refval2: | ||
.word 0x8BADF00D | ||
|
||
.balign 32 | ||
.globl refval3 | ||
refval3: | ||
.word 0xA5A5A5A5 |
Oops, something went wrong.