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 RNG driver #54

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

jerome-pouiller
Copy link
Contributor

This work is inspired of the Tibor's work.

This PR also align build.yml and upstream-build.yml.

@jerome-pouiller
Copy link
Contributor Author

FYI, this PR allow to get rid of this warning when building WiFi example:

CMake Warning at /home/jerome/zephyr/zephyr/subsys/random/CMakeLists.txt:12 (message):


      Warning: CONFIG_TIMER_RANDOM_GENERATOR is not a truly random generator.
      This capability is not secure and it is provided for testing purposes only.
      Use it carefully.


CMake Warning at /home/jerome/zephyr/zephyr/CMakeLists.txt:953 (message):
  No SOURCES given to Zephyr library: drivers__entropy

  Excluding target from build.

@jerome-pouiller jerome-pouiller force-pushed the siwx917-rng branch 3 times, most recently from 856e75c to be0227f Compare October 22, 2024 13:28
@jhedberg jhedberg added the DNM label Oct 22, 2024
@jhedberg
Copy link
Collaborator

Looks good, but I added the DNM label until the HAL PR has been merged and west.yml updated.


static int siwx917_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length)
{
return siwx917_get_entropy_isr(dev, buffer, length, ENTROPY_BUSYWAIT);
Copy link
Contributor

Choose a reason for hiding this comment

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

The API description says: "This call has to be thread safe to satisfy requirements of the random subsystem."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, I believe RSI_RNG_GetBytes() and all the subfunctions (mainly rng_get_bytes()) are thread safe. So I didn't keep the spinlock.

jerome-pouiller and others added 4 commits October 24, 2024 16:34
Support for random number generator is required for most of the
cryptographic operations, including support for WiFi and TLS.

This driver has been tested with tests/drivers/entropy:

    *** Booting Zephyr OS build v3.7.0-4339-g1ec5ce05f9f8 ***
    Running TESTSUITE entropy_api
    ===================================================================
    START - test_entropy_get_entropy
    random device is 0x8217298, name is rng@45090000
      0x93
      0x3e
      0xf1
      0x68
      0xd4
      0x22
      0xbf
      0x4d
      0xad
     PASS - test_entropy_get_entropy in 0.012 seconds
    ===================================================================
    TESTSUITE entropy_api succeeded

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

    SUITE PASS - 100.00% [entropy_api]: pass = 1, fail = 0, skip = 0 ...
     - PASS - [entropy_api.test_entropy_get_entropy] duration = 0.01 ...

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

    ===================================================================
    RunID: d1547c805699201af769cb01331efcce
    PROJECT EXECUTION SUCCESSFUL

Co-authored-by: Tibor Laczko <[email protected]>
Signed-off-by: Tibor Laczko <[email protected]>
Signed-off-by: Jérôme Pouiller <[email protected]>
Change indentation level of build.yml to match upstream-build.yml.

Signed-off-by: Jérôme Pouiller <[email protected]>
upstream-build.yml and build.yml didn't invoke twister in the same nor
with the same tests.

Note $EXTRA_TWISTER_FLAGS was used in all the tests. Yet, CI still runs
on Windows. So, this commit get rid of EXTRA_TWISTER_FLAGS in all the
invocations.

Signed-off-by: Jérôme Pouiller <[email protected]>
It makes sense to check we don't break the entropy driver.

Signed-off-by: Jérôme Pouiller <[email protected]>
@jerome-pouiller jerome-pouiller merged commit 49b5a1b into SiliconLabsSoftware:main Oct 24, 2024
5 of 6 checks passed
@jerome-pouiller jerome-pouiller deleted the siwx917-rng branch October 24, 2024 14:53
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