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

tests: subsys: jwt: libraries.encoding.jwt.rsa.psa fails #79864

Open
katgiadla opened this issue Oct 15, 2024 · 7 comments · May be fixed by zephyrproject-rtos/trusted-firmware-m#117 or #81869
Open

tests: subsys: jwt: libraries.encoding.jwt.rsa.psa fails #79864

katgiadla opened this issue Oct 15, 2024 · 7 comments · May be fixed by zephyrproject-rtos/trusted-firmware-m#117 or #81869
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug

Comments

@katgiadla
Copy link
Collaborator

katgiadla commented Oct 15, 2024

Describe the bug
The test tests/subsys/jwt/libraries.encoding.jwt.rsa.psa fails

Observed for:

  • nrf5340dk/nrf5340/cpuapp/ns
  • nrf9160dk/nrf9160/ns

To Reproduce
Steps to reproduce the behavior:

  1. have nrf9160dk/nrf9160/ns connected
  2. go to your zephyr dir
  3. call ./scripts/twister -T tests/subsys/jwt -p nrf9160dk/nrf9160/ns --device-testing --device-serial /dev/ttyACM0 -v --inline-logs --west-flash="--erase"
  4. See console output with error

Expected behavior
Valid console output

Impact
Not clear

Logs and console output

*** Booting Zephyr OS build v3.7.0-4339-g1ec5ce05f9f8 ***
Running TESTSUITE jwt_tests
===================================================================
START - test_jwt

    Assertion failed at zephyr/tests/subsys/jwt/src/main.c:48: jwt_tests_test_jwt: (res not equal to 0)
Signing payload
 FAIL - test_jwt in 0.022 seconds
===================================================================
TESTSUITE jwt_tests failed.

------ TESTSUITE SUMMARY START ------

SUITE FAIL -   0.00% [jwt_tests]: pass = 0, fail = 1, skip = 0, total = 1 duration = 0.022 seconds
 - FAIL - [jwt_tests.test_jwt] duration = 0.022 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
RunID: 8cf83447ecd64014499884f8a73d7731
PROJECT EXECUTION FAILED

Environment (please complete the following information):

  • OS: Ubuntu 20.04.1 LTS
  • Toolchain Zephyr SDK 0.16.8
  • Commit SHA or Version used: v3.7.0-4232-g9b5260de9a31

Additional context
Probably introduced by 29e82d2

@katgiadla katgiadla added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug platform: nRF Nordic nRFx labels Oct 15, 2024
@nordic-piks nordic-piks assigned jukkar and rlubos and unassigned anangl and masz-nordic Nov 21, 2024
@github-project-automation github-project-automation bot moved this to To triage in nRF platform Nov 22, 2024
@nordic-piks nordic-piks moved this from To triage to Backlog in nRF platform Nov 22, 2024
@jukkar
Copy link
Member

jukkar commented Nov 22, 2024

Does not seem to be network related so re-assigning. PSA mentioned, so @tomi-font can you take a look at this?

@jukkar jukkar assigned tomi-font and unassigned jukkar and rlubos Nov 22, 2024
@tomi-font
Copy link
Collaborator

@valeriosetti touched this, so passing the hot potato to him.

@tomi-font tomi-font assigned valeriosetti and unassigned tomi-font Nov 22, 2024
@tomi-font
Copy link
Collaborator

Curious to know, @katgiadla how did you come up with the "probably introduced by" commit?

@katgiadla
Copy link
Collaborator Author

Curious to know, @katgiadla how did you come up with the "probably introduced by" commit?

I've used bisection to get probably reason of the bug. It is important to confirm, if the marked commit is real cause of the bug.

@valeriosetti
Copy link
Collaborator

valeriosetti commented Nov 22, 2024

Short answer

I still haven't found a solution for this, but my suspects are that builds with TF-M does not fully support RSA signature. I need to investigate further.

Explanation

I checked that:

  • west build -p always -b nrf9160dk/nrf9160 --test tests/subsys/jwt/libraries.encoding.jwt.rsa.psa is OK
  • west build -p always -b nrf9160dk/nrf9160/ns --test tests/subsys/jwt/libraries.encoding.jwt.rsa.psa FAILS

In both cases I tested on a real device flashing it with west flash --runner nrfutil and then looking at the console.
The only difference between the 2 devices is that the 1st one does not have TF-M, while the 2nd one yes.

The same issue happens also if I replace the NRF9160 board with a mps2/an521/cpu0 one (this is another board that has both the TF-M and non-TF-M images available in Zephyr) and I can test it with QEMU.

@valeriosetti
Copy link
Collaborator

After digging a bit more on this issue, it turned out to be a TF-M limitation: it did not allocate enough heap memory to the crypto partition in order to allow RSA 2048-bit signatures. This should be fixed by #81869

@valeriosetti
Copy link
Collaborator

valeriosetti commented Nov 25, 2024

@katgiadla once #81869 has CI green (a part from the dnm label, of course), can you please:

  • checkout at current PR
  • run west update
  • re-test the failing test
    ?

Edit: I tried the PR locally on a nrf9160dk board with
twister -c -p nrf9160dk/nrf9160/ns -T tests/subsys/jwt --device-testing --device-serial /dev/ttyACM0 -v --inline-logs --west-flash="--erase" --west-runner nrfutil
and it worked just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug
Projects
Status: Backlog
7 participants