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

Adds tests against the wycheproof test vectors #630

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

andozw
Copy link
Collaborator

@andozw andozw commented Jun 7, 2023

Along the same spirit as the secp256k1 PR 1245. This tests against all 463 vectors but includes exclusions for 3 of them. Comments include the details outlining why each was excluded.

The json and c code was generated using the included python code (utils/tests_wycheproof_generate.py).

We decided not to duplicate this generation code for now.

@andozw andozw requested review from ivmaykov and oreparaz as code owners June 7, 2023 19:00
@andozw andozw force-pushed the seana.20230607.wycheproof-tests-pr branch 2 times, most recently from 442bb1f to a899629 Compare June 7, 2023 19:06
Copy link
Collaborator

@oreparaz oreparaz left a comment

Choose a reason for hiding this comment

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

LGTM. The 3 test cases we skip sound reasonable to me.

Can you please put a comment here with:

  • old binary size
  • new binary size
  • difference in kB

Thanks!

oreparaz
oreparaz previously approved these changes Jun 7, 2023
Copy link
Collaborator

@oreparaz oreparaz left a comment

Choose a reason for hiding this comment

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

LGTM. The 3 test cases we skip sound reasonable to me.

Can you please put a comment here with:

  • old binary size
  • new binary size
  • difference in kB

Thanks!

@ivmaykov
Copy link
Contributor

ivmaykov commented Jun 7, 2023

It looks like the subzero core binary failed to start in the background in the SignTx regression test action. Hard to tell what's going on, we probably need to improve the logic in the action so it's easier to get logs output. Did you run it locally with ASAN + UBSAN without any issues?

core/CMakeLists.txt Outdated Show resolved Hide resolved
core/src/checks/self_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
core/trezor-crypto/ecdsa.c Outdated Show resolved Hide resolved
@andozw andozw force-pushed the seana.20230607.wycheproof-tests-pr branch from a899629 to 81a3d9b Compare June 8, 2023 19:17
@andozw
Copy link
Collaborator Author

andozw commented Jun 8, 2023

It looks like the subzero core binary failed to start in the background in the SignTx regression test action. Hard to tell what's going on, we probably need to improve the logic in the action so it's easier to get logs output. Did you run it locally with ASAN + UBSAN without any issues?

Ran locally with time(1). Took about 0.5 seconds without ASAN/UBSAN flags and about 2.6 seconds with ASAN/UBSAN.

Added sleeps in the CI script and the tests execute successfully which confirms the theory.

@andozw
Copy link
Collaborator Author

andozw commented Jun 8, 2023

  • old binary size
  • new binary size
  • difference in kB

Old binary size: 546916 bytes
New binary size: 629876 bytes
Difference ~82.9 kB

@ivmaykov
Copy link
Contributor

ivmaykov commented Jun 8, 2023

Approving with some nits, please fix them before merging.

ivmaykov
ivmaykov previously approved these changes Jun 8, 2023
Copy link
Contributor

@ivmaykov ivmaykov left a comment

Choose a reason for hiding this comment

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

Actually approving this time.

core/src/checks/wycheproof_checks.c Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
.github/workflows/signtx-test.yml Show resolved Hide resolved
core/src/checks/self_checks.c Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Show resolved Hide resolved
core/src/checks/wycheproof_checks.c Outdated Show resolved Hide resolved
Copy link
Contributor

@ivmaykov ivmaykov left a comment

Choose a reason for hiding this comment

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

LGTM

Along the same spirit as the secp256k1 PR 1245. This tests against all
463 vectors but includes exclusions for 3 of them. Comments include the
details outlining why each was excluded.

The json and c code was generated using the included python code
(utils/tests_wycheproof_generate.py).
@andozw andozw force-pushed the seana.20230607.wycheproof-tests-pr branch from 642c433 to 069a863 Compare June 9, 2023 19:15
@andozw andozw merged commit fe57921 into square:master Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants