Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

twilfredo
Copy link
Contributor

@twilfredo twilfredo commented Mar 2, 2023

Pull Request Overview

Bumps the opentitan commit sha to match the latest RTL version as of this commit lowrisc/opentitan@8a3159dbeb743a64c6898e1e8ecac4f18808c00c.

Notes: I've not gotten the rsa.elf to build, thus OTBN needs testing. Vivado 2020.2 LabEdition is required now for this, build process uses updatemem for some splicing. I've updated the README in this PR to reflect.

Testing Strategy

By running the unit tests on Verilator. ( This took ~8hrs 😢 )

I00000 test_rom.c:136] Version: earlgrey_silver_release_v5-9863-g8a3159dbe, Build Date: 2023-03-02 10:57:51
I00001 test_rom.c:238] Test ROM complete, jumping to flash (addr: 20000400)!
OpenTitan initialisation complete. Entering main loop
check run AES128 CCM... 
AES CCM* encryption/decryption tests
aes_ccm_test passed: (current_test=0, encrypting=true, tag_is_valid=true)
aes_ccm_test passed: (current_test=0, encrypting=false, tag_is_valid=true)
aes_ccm_test passed: (current_test=1, encrypting=true, tag_is_valid=true)
aes_ccm_test passed: (current_test=1, encrypting=false, tag_is_valid=true)
aes_ccm_test passed: (current_test=2, encrypting=true, tag_is_valid=true)
aes_ccm_test passed: (current_test=2, encrypting=false, tag_is_valid=true)
    [ok]
check run AES128 ECB... 
aes_test passed (ECB Enc Src/Dst)
aes_test passed (ECB Dec Src/Dst)
aes_test passed (ECB Enc In-place)
aes_test passed (ECB Dec In-place)
    [ok]
check run AES128 CBC... 
aes_test passed (CBC Enc Src/Dst)
aes_test passed (CBC Dec Src/Dst)
aes_test passed (CBC Enc In-place)
aes_test passed (CBC Dec In-place)
    [ok]
check run AES128 CTR... 
aes_test CTR passed: (CTR Enc Ctr Src/Dst)
aes_test CTR passed: (CTR Dec Ctr Src/Dst)
    [ok]
check run CSRNG Entropy 32... 
Entropy32 test: first get Ok(())
Entropy test: obtained all 8 values. They are:
[00]: 735b27a0
[01]: 497b246f
[02]: 9a8f9420
[03]: 91618fe9
[04]: e07e680b
[05]: 01aec0b9
[06]: 3ca6b2a0
[07]: 19078a9d
    [ok]
check hmac load binary... 
    [ok]
check hmac check verify... 
    [ok]
start multi alarm test...
    [ok]
check otbn run binary...
check otbn run rsa binary...
    [ok]
check rsa exponent... 
    [ok]
check rsa exponent one... 
    [ok]
check rsa key import... 
    [ok]
check rsa 4096 bit key import... 
    [ok]
check rsa 4096 exponent... 
    [ok]
start SHA256 verify test
Sha256Test: Setting slice to 12..24
Sha256Test: Setting slice to 24..36
Sha256Test: Setting slice to 36..48
Sha256Test: Setting slice to 48..60
Sha256Test: Setting slice to 60..72
Sha256Test: Verification result: Ok(true)
    [ok]
check SipHash 2-4... 
    [ok]
[SPI] Setup spi_host0 partial_transfer... 
    [ok]
[SPI] Setup spi_host0 transfers... 
    [ok]
[SPI] Setup spi_host0 transfer...x2 
    [ok]
start TicKV append key test...
---Starting TicKV Tests---
Generated key: [61, 245, 130, 62, 163, 73, 69, 239]
Now appending the key
Key: [61, 245, 130, 62, 163, 73, 69, 239] with value [16, 32, 48] was added
Now retrieving the key
Key: [61, 245, 130, 62, 163, 73, 69, 239] with value [16, 32, 48, 0] was retrieved
Removed Key: [61, 245, 130, 62, 163, 73, 69, 239]
Try to read removed key: [61, 245, 130, 62, 163, 73, 69, 239]
Unable to find key: [61, 245, 130, 62, 163, 73, 69, 239]
Let's start a garbage collection
Finished garbage collection
---Finished TicKV Tests---
    [ok]
[FLASH_CTRL] Test page read/write....
    [ok]
[FLASH_CTRL] Test page erase....
    [ok]
[FLASH_CTRL] Test memory protection api....
    [ok]
[FLASH_CTRL] Test memory protection functionality....
    [ok]
trivial assertion... 
    [ok]

TODO or Help Wanted

  • HW Testing
  • Test using rsa.elf

Should we provide the rsa.tbf? So people don't need to Vivado?

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the WG-OpenTitan In the purview of the OpenTitan working group. label Mar 2, 2023
@twilfredo twilfredo marked this pull request as draft March 2, 2023 02:52
Bumps the opentitan commit sha to match the latest RTL version as of
this commit. The changes have been tested using Verilator as per usual.
However, the `rsa.elf` does not build, thus OTBN needs testing.

Signed-off-by: Wilfred Mallawa <[email protected]>
With the latest build of Opentitan, it requires Vivado 2020.2 LabEdition
which has `updatemem`. This is used to splice the bitsream and is
required in the build process for `otbn_rsa_X"

Signed-off-by: Wilfred Mallawa <[email protected]>
@twilfredo twilfredo force-pushed the wilfred/ot_bump_02_03_23 branch from 623b11f to dd4adea Compare March 2, 2023 03:36
Ensure the correct objcopy is being passed to run script

Signed-off-by: Wilfred Mallawa <[email protected]>
@twilfredo
Copy link
Contributor Author

twilfredo commented Mar 2, 2023

@alistair23 When using the latest version of elf2tab to convert the rsa.elf to a tbf file, then loading it. I noticed that we are either reading the tbf header wrong:

let imem_length = entry_length - dmem_length - header_length as u32 - 4;
or its is being generated incorrectly.

I found this because imem_length was 16k (instead of 1684..I think) which caused an out of bounds panic here

self.registers.imem[i].set(d);
However, fixed when using elf2tab tag v0.10.0. I've added a small change in this PR to avoid the bloat that comes with it.

Simple bounds check to see if the imem size can fit the destination
register set.

Signed-off-by: Wilfred Mallawa <[email protected]>
@twilfredo twilfredo force-pushed the wilfred/ot_bump_02_03_23 branch from f88abd0 to b3bc9c8 Compare March 2, 2023 23:29
@twilfredo twilfredo marked this pull request as ready for review March 2, 2023 23:36
@alistair23
Copy link
Contributor

Just tested! Works for me, let's merge this

Copy link
Contributor

@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 17, 2023

@bors bors bot merged commit 86631f3 into tock:master Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WG-OpenTitan In the purview of the OpenTitan working group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants