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

Add HIL test for ECC #1418

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Add HIL test for ECC #1418

merged 2 commits into from
Apr 10, 2024

Conversation

JurajSadel
Copy link
Contributor

@JurajSadel JurajSadel commented Apr 10, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • My changes were added to the CHANGELOG.md in the proper section.

Extra:

Pull Request Details 📖

Description

Adds a HIL test for ECC - it's basically a copy-pasted example.

Testing

Tested locally on C6 and @SergioGasquez helped me with testing on H2 (my H2 is dead). Also, the HIL CI run in my fork/branch of this PR: https://github.com/esp-rs/esp-hal/actions/runs/8630865547

@JurajSadel JurajSadel added the skip-changelog No changelog modification needed label Apr 10, 2024
@SergioGasquez
Copy link
Member

SergioGasquez commented Apr 10, 2024

For future reference (whenever we add C2 support), the tests are also passing for C2! Including the test_ecc_finite_field_division which is C2 specific.

    Finished `test` profile [optimized + debuginfo] target(s) in 0.16s
     Running tests/ecc.rs (target/riscv32imc-unknown-none-elf/debug/deps/ecc-c31488a1dbb8ddd4)
Using 40MHz bootloader
      Erasing ✔ [00:00:00] [#############################################] 256.00 KiB/256.00 KiB @ 312.61 KiB/s (eta 0s )
  Programming ✔ [00:00:02] [################################################] 90.22 KiB/90.22 KiB @ 35.30 KiB/s (eta 0s )    Finished in 3.464s

running 7 tests
test tests::test_ecc_affine_point_multiplication                      ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 1859059532 while buffer size is 1024 for "up" channel 0 (defmt)
ok
test tests::test_ecc_affine_point_verification                        ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 2745824073 while buffer size is 1024 for "up" channel 0 (defmt)
ok
test tests::test_ecc_afine_point_verification_multiplication          ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 3543281821 while buffer size is 1024 for "up" channel 0 (defmt)
ok
test tests::test_ecc_jacobian_point_multiplication                    ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 2175919388 while buffer size is 1024 for "up" channel 0 (defmt)
ok
test tests::test_jacobian_point_verification                          ... ok
test tests::test_ecc_afine_point_verification_jacobian_multiplication ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 4259156474 while buffer size is 1024 for "up" channel 0 (defmt)
ok
test tests::test_ecc_finite_field_division                            ... ERROR probe_rs::util::rtt: 
Error reading from RTT: The control block has been corrupted. write pointer is 497107320 while buffer size is 1024 for "up" channel 0 (defmt)
ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 35.23s

As usual some noisy-irrelevant probe-rs errors in C2, feel free to ignore them

Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

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

Changes mostly LGTM! Left a few things to fix

hil-test/tests/ecc.rs Show resolved Hide resolved
hil-test/tests/ecc.rs Outdated Show resolved Hide resolved
Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

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

LGTM! As discussed, the only thing that I see is that we could make the test faster if we already have the expected output hard-coded instead of calculating them with sw and comparing them. Not sure how much this will save us and if it's relevant, though

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jessebraham jessebraham added this pull request to the merge queue Apr 10, 2024
@SergioGasquez
Copy link
Member

Since #1414 got already merged, well need to rebase this PR

@jessebraham
Copy link
Member

Yeah my bad didn't notice the conflict before adding it to the queue 😅

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Apr 10, 2024
@jessebraham jessebraham added this pull request to the merge queue Apr 10, 2024
Merged via the queue into esp-rs:main with commit c73a2d9 Apr 10, 2024
21 checks passed
@JurajSadel JurajSadel deleted the hil-test-ecc branch April 10, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants